openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03691
[Merge] lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde into lp:sale-wkfl
Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde into lp:sale-wkfl.
Requested reviews:
Sale Core Editors (sale-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde/+merge/205623
Hello,
In a dropshipping context,
this branch allows to avoid to confirm a sale line of type 'make_to_order'
if this line comes from a product without supplierinfos (for the moment, a dropshipping sale line without supplierinfo defined leads to a procurement in exception expecting a supplier defined on the product)
At sales confirmation, a warning message suggests to add supplierinfos on the product form.
Romain
--
https://code.launchpad.net/~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde/+merge/205623
Your team Sale Core Editors is requested to review the proposed merge of lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde into lp:sale-wkfl.
=== modified file 'sale_dropshipping/sale.py'
--- sale_dropshipping/sale.py 2013-11-08 13:26:48 +0000
+++ sale_dropshipping/sale.py 2014-02-10 16:53:15 +0000
@@ -20,6 +20,7 @@
#
##############################################################################
from openerp.osv import orm, fields
+from openerp.tools.translate import _
import netsvc
@@ -138,6 +139,21 @@
cr, uid, order, normal_lines, None, context)
return res
+ def action_button_confirm(self, cr, uid, ids, context=None):
+ for sale in self.browse(cr, uid, ids, context=context):
+ for line in sale.order_line:
+ if (line.type == 'make_to_order' and
+ line.sale_flow in
+ ('direct_delivery', 'direct_invoice_and_delivery') and
+ not line.product_id.seller_ids):
+ raise orm.except_orm(_('Warning!'),
+ _('Please set at least one supplier '
+ 'on the product: "%s" (code: %s)') %
+ (line.product_id.name,
+ line.product_id.default_code,))
+ return super(sale_order, self).action_button_confirm(cr, uid, ids,
+ context=context)
+
class procurement_order(orm.Model):
_inherit = 'procurement.order'
Follow ups