From 353f7026a15571490010a804828bf6b129753e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 28 Feb 2010 00:52:50 -0300 Subject: [PATCH 1/2] [REF] [MRP] action_produce_assign_product method refactoring: several mrp.production where made and not linked to their procurement only last id was returned. -> Not possible to override cleany for instance to pass custom options from a procurement to a production order. Implemented it with the {} trick. This is debatable whether {} links or hook before creation is better. At least now you can override it... bzr revid: rvalyi@gmail.com-20100228035250-xnp9q1tx5j0sjnlr --- addons/mrp/mrp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index bea0e5f2b94..a7f4b6b739f 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1115,7 +1115,7 @@ class mrp_procurement(osv.osv): return True def action_produce_assign_product(self, cr, uid, ids, context={}): - produce_id = False + res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id for procurement in self.browse(cr, uid, ids): res_id = procurement.move_id.id @@ -1136,6 +1136,7 @@ class mrp_procurement(osv.osv): 'move_prod_id': res_id, 'company_id': procurement.company_id.id, }) + res[procurement.id] = produce_id self.write(cr, uid, [procurement.id], {'state':'running'}) bom_result = self.pool.get('mrp.production').action_compute(cr, uid, [produce_id], properties=[x.id for x in procurement.property_ids]) @@ -1143,7 +1144,7 @@ class mrp_procurement(osv.osv): wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr) self.pool.get('stock.move').write(cr, uid, [res_id], {'location_id':procurement.location_id.id}) - return produce_id + return res def action_po_assign(self, cr, uid, ids, context={}): purchase_id = False From dc1722f35d10f84c13bfce7e116302dc689dfe35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 28 Feb 2010 01:16:10 -0300 Subject: [PATCH 2/2] [REF] [MRP] action_po_assign method refactoring: several purchase.order where made and not linked to their procurement only last id was returned. -> Not possible to override cleany for instance to pass custom options from a procurement to a production order. Implemented it with the {} trick. This is debatable whether {} links or hook before creation is better. At least now you can override it... bzr revid: rvalyi@gmail.com-20100228041610-knbvwzptzgzjyq42 --- addons/mrp/mrp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index a7f4b6b739f..29300198523 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1147,7 +1147,7 @@ class mrp_procurement(osv.osv): return res def action_po_assign(self, cr, uid, ids, context={}): - purchase_id = False + res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id for procurement in self.browse(cr, uid, ids): res_id = procurement.move_id.id @@ -1199,8 +1199,9 @@ class mrp_procurement(osv.osv): 'company_id': procurement.company_id.id, 'fiscal_position': partner.property_account_position and partner.property_account_position.id or False }) + res[procurement.id] = purchase_id self.write(cr, uid, [procurement.id], {'state':'running', 'purchase_id':purchase_id}) - return purchase_id + return res def action_cancel(self, cr, uid, ids): todo = []