Skip to content
Snippets Groups Projects
Commit 8eae018b authored by Holger Brunn's avatar Holger Brunn Committed by Martin Trigaux
Browse files

[FIX] mrp: keep traceability of procurement.group

Pass group_id information when a manufacturing order is created from
a procurement to keep a better traceability and know the reason of stock.move
creation.
Fixes #4019
parent def9222b
No related branches found
No related tags found
No related merge requests found
......@@ -1041,7 +1041,8 @@ class mrp_production(osv.osv):
source_location_id = production.product_id.property_stock_production.id
destination_location_id = production.location_dest_id.id
procs = proc_obj.search(cr, uid, [('production_id', '=', production.id)], context=context)
procurement_id = procs and procs[0] or False
procurement = procs and\
proc_obj.browse(cr, uid, procs[0], context=context) or False
data = {
'name': production.name,
'date': production.date_planned,
......@@ -1053,10 +1054,11 @@ class mrp_production(osv.osv):
'location_id': source_location_id,
'location_dest_id': destination_location_id,
'move_dest_id': production.move_prod_id.id,
'procurement_id': procurement_id,
'procurement_id': procurement and procurement.id,
'company_id': production.company_id.id,
'production_id': production.id,
'origin': production.name,
'group_id': procurement and procurement.group_id.id,
}
move_id = stock_move.create(cr, uid, data, context=context)
#a phantom bom cannot be used in mrp order so it's ok to assume the list returned by action_confirm
......@@ -1141,6 +1143,7 @@ class mrp_production(osv.osv):
'price_unit': product.standard_price,
'origin': production.name,
'warehouse_id': loc_obj.get_warehouse(cr, uid, production.location_src_id, context=context),
'group_id': production.move_prod_id.group_id.id,
}, context=context)
if prev_move:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment