Merge lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde into lp:~sale-core-editors/sale-wkfl/7.0

Proposed by Romain Deheele - Camptocamp
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 32
Merged at revision: 36
Proposed branch: lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde
Merge into: lp:~sale-core-editors/sale-wkfl/7.0
Diff against target: 33 lines (+16/-0)
1 file modified
sale_dropshipping/sale.py (+16/-0)
To merge this branch: bzr merge lp:~camptocamp/sale-wkfl/7.0-avoid_sale_lines_dropshipping_make_to_order_without_supplierinfos-rde
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests Approve
Nicolas Bessi - Camptocamp (community) code review, no test Approve
Review via email: mp+205623@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

LGTM,
Romain can you please tell me if tests are still green?

review: Needs Information
Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

which tests exactly?

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Ok, there is no test on module, my fault.

LGTM

review: Approve (code review, no test)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) :
review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_dropshipping/sale.py'
2--- sale_dropshipping/sale.py 2013-11-08 13:26:48 +0000
3+++ sale_dropshipping/sale.py 2014-02-10 16:53:15 +0000
4@@ -20,6 +20,7 @@
5 #
6 ##############################################################################
7 from openerp.osv import orm, fields
8+from openerp.tools.translate import _
9 import netsvc
10
11
12@@ -138,6 +139,21 @@
13 cr, uid, order, normal_lines, None, context)
14 return res
15
16+ def action_button_confirm(self, cr, uid, ids, context=None):
17+ for sale in self.browse(cr, uid, ids, context=context):
18+ for line in sale.order_line:
19+ if (line.type == 'make_to_order' and
20+ line.sale_flow in
21+ ('direct_delivery', 'direct_invoice_and_delivery') and
22+ not line.product_id.seller_ids):
23+ raise orm.except_orm(_('Warning!'),
24+ _('Please set at least one supplier '
25+ 'on the product: "%s" (code: %s)') %
26+ (line.product_id.name,
27+ line.product_id.default_code,))
28+ return super(sale_order, self).action_button_confirm(cr, uid, ids,
29+ context=context)
30+
31
32 class procurement_order(orm.Model):
33 _inherit = 'procurement.order'

Subscribers

People subscribed via source and target branches