Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-17431-rha into 
lp:openobject-addons/6.0.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17431-rha/+merge/75501

Hello,

When selling a product(MTO,Produce) with phantom BoM then it shows wrong stock 
location in stock moves for the product and also for component product. This 
fix solves the problem.

Thanks,
Rifakat
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-17431-rha/+merge/75501
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-17431-rha.
=== modified file 'mrp/stock.py'
--- mrp/stock.py	2011-01-17 08:00:48 +0000
+++ mrp/stock.py	2011-09-15 08:54:25 +0000
@@ -55,7 +55,8 @@
                 factor = move.product_qty
                 bom_point = bom_obj.browse(cr, uid, bis[0], context=context)
                 res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
-                dest = move.product_id.product_tmpl_id.property_stock_production.id
+                dest = move.sale_line_id and move.sale_line_id.order_id.shop_id.warehouse_id.lot_output_id.id or \
+                       move.product_id.product_tmpl_id.property_stock_production.id
                 state = 'confirmed'
                 if move.state == 'assigned':
                     state = 'assigned'
@@ -91,8 +92,10 @@
                         'move_id': mid,
                     })
                     wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
+                pack_location = move.sale_line_id and move.sale_line_id.order_id.shop_id.warehouse_id.lot_output_id.id or \
+                                move.location_dest_id.id
                 move_obj.write(cr, uid, [move.id], {
-                    'location_id': move.location_dest_id.id,
+                    'location_id': pack_location,
                     'auto_validate': True,
                     'picking_id': False,
                     'state': 'waiting'

=== modified file 'sale/sale.py'
--- sale/sale.py	2011-08-29 11:57:12 +0000
+++ sale/sale.py	2011-09-15 08:54:25 +0000
@@ -660,7 +660,9 @@
         company = self.pool.get('res.users').browse(cr, uid, uid).company_id
         for order in self.browse(cr, uid, ids, context={}):
             proc_ids = []
-            output_id = order.shop_id.warehouse_id.lot_output_id.id
+            output_id = order.partner_id.property_stock_customer and \
+                        order.partner_id.property_stock_customer.id or \
+                        order.shop_id.warehouse_id.lot_output_id.id
             picking_id = False
             for line in order.order_line:
                 proc_id = False

_______________________________________________
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