From ec217d2593fe1e7790e82b4a16bb9020f5894bbe Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 24 Nov 2010 17:11:51 +0530 Subject: [PATCH] [IMP] sale:'Recreate procurement' on shipping exception now works with more than one sale order line bzr revid: mtr@mtr-20101124114151-mn9u8b0oyicaj0jr --- addons/sale/sale.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 27740cb..793d779 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -676,6 +676,7 @@ class sale_order(osv.osv): company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] + new_moves = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: @@ -724,6 +725,8 @@ class sale_order(osv.osv): 'note': line.notes, 'company_id': order.company_id.id, }) + new_moves.append(move_id) + if line.product_id: proc_id = self.pool.get('procurement.order').create(cr, uid, { 'name': line.name, @@ -749,8 +752,9 @@ class sale_order(osv.osv): for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': - move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) - proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) + for move_id in new_moves: + move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) + proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) val = {} for proc_id in proc_ids: wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) -- 1.7.10.4