← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~kinner-vachhani/sale-wkfl/lp-1317035 into lp:sale-wkfl

 

Kinner Vachhani has proposed merging lp:~kinner-vachhani/sale-wkfl/lp-1317035 into lp:sale-wkfl.

Requested reviews:
  Sale Core Editors (sale-core-editors)
Related bugs:
  Bug #1317035 in Sales - Workflow and Organization: "[drop shipping] changing sale flow to drop shipping does not work"
  https://bugs.launchpad.net/sale-wkfl/+bug/1317035

For more details, see:
https://code.launchpad.net/~kinner-vachhani/sale-wkfl/lp-1317035/+merge/223877

changing sale flow to drop shipping does not work
-- 
https://code.launchpad.net/~kinner-vachhani/sale-wkfl/lp-1317035/+merge/223877
Your team Sale Core Editors is requested to review the proposed merge of lp:~kinner-vachhani/sale-wkfl/lp-1317035 into lp:sale-wkfl.
=== modified file 'sale_dropshipping/sale.py'
--- sale_dropshipping/sale.py	2014-03-21 14:55:59 +0000
+++ sale_dropshipping/sale.py	2014-06-20 09:16:04 +0000
@@ -60,6 +60,18 @@
             result[order_line.id] = po_line_ids and po_line_ids[0] or False
         return result
 
+    def onchange_sale_flow(self, cr, uid, ids, sale_flow, product_id, context=None):
+        """ Change type to make_to_order when sale_flow is direct_delivery """
+
+        vals = {}
+        if product_id:
+            if sale_flow == 'direct_delivery':
+                vals['type'] = 'make_to_order'
+            else:
+                vals['type'] = self.pool.get('product.product').browse(cr,uid,product_id).procure_method
+        return {'value': vals}
+
+
     _columns = {
         'sale_flow': fields.selection([('normal', 'Normal'),
                                        ('direct_delivery', 'Drop Shipping'),

=== modified file 'sale_dropshipping/sale_view.xml'
--- sale_dropshipping/sale_view.xml	2013-09-06 10:40:30 +0000
+++ sale_dropshipping/sale_view.xml	2014-06-20 09:16:04 +0000
@@ -19,11 +19,11 @@
         <field name="inherit_id" ref="sale.view_order_form" />
         <field name="arch" type="xml">
             <xpath expr="/form/sheet//field[@name='order_line']/tree/field[@name='name']" position="before">
-                <field name="sale_flow" />
+                <field name="sale_flow" on_change="onchange_sale_flow(sale_flow, product_id, context)"/>
             </xpath>
             <xpath expr="/form/sheet//field[@name='order_line']/form//label[@for='name']" position="before">
                 <group attrs="{'invisible': [('type', '=', 'make_to_stock')]}" colspan="2" cols="2">
-                    <field name="sale_flow"/>
+                    <field name="sale_flow" on_change="onchange_sale_flow(sale_flow, product_id, context)"/>
                     <field name="purchase_order_line_id"/>
                     <field name="purchase_order_id" readonly="1"/>
                     <field name="purchase_order_state" readonly="1"/>


Follow ups