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] [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 = []