Ravi Gohil (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-bug-725571-rgo into 
lp:openobject-addons/6.0.

Requested reviews:
  Anup(OpenERP) (ach-openerp)
  Jay Vora (OpenERP) (jvo-openerp)
Related bugs:
  Bug #725571 in OpenERP Addons: "Sale : Change in configuration of policy 
doesn't get considered once set !"
  https://bugs.launchpad.net/openobject-addons/+bug/725571

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-725571-rgo/+merge/68682

Hello Sir,

I have made changes according you specified, Now it will consider the Output 
Location from the warehouse instead of 'stock_location_output'.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-725571-rgo/+merge/68682
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-bug-725571-rgo.
=== modified file 'sale/sale.py'
--- sale/sale.py	2011-07-07 10:50:50 +0000
+++ sale/sale.py	2011-07-21 13:08:35 +0000
@@ -1198,15 +1198,30 @@
     }
 
     def execute(self, cr, uid, ids, context=None):
+        ir_values_obj = self.pool.get('ir.values')
+        ir_model_data_obj = self.pool.get('ir.model.data')
+        stock_location_obj = self.pool.get('stock.location')
+        
+        comp_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
+        
+        warehouse_obj = self.pool.get('stock.warehouse')
+        warehouse_ids = warehouse_obj.search(cr, uid, [('company_id', '=', comp_id)])
+        warehouses = warehouse_obj.browse(cr, uid, warehouse_ids, context=context)
+        
+        location_ids = []
+        for output_loc_ids in warehouses:
+            location_ids.append(output_loc_ids.lot_output_id.id)
+        
+        chaining_type = False
         for o in self.browse(cr, uid, ids, context=context):
-            ir_values_obj = self.pool.get('ir.values')
             ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], o.picking_policy)
             ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], o.order_policy)
-            if o.step == 'two':
-                md = self.pool.get('ir.model.data')
-                location_id = md.get_object_reference(cr, uid, 'stock', 'stock_location_output')
-                location_id = location_id and location_id[1] or False
-                self.pool.get('stock.location').write(cr, uid, [location_id], {'chained_auto_packing': 'manual'})
+            if o.step == 'one':
+                chaining_type = 'transparent'
+            else:
+                chaining_type = 'manual'
+            for record in location_ids:
+                stock_location_obj.write(cr, uid, [record], {'chained_auto_packing': chaining_type})
 
 sale_config_picking_policy()
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to