From: mtr Date: Wed, 24 Nov 2010 11:41:51 +0000 (+0530) Subject: [IMP] sale:'Recreate procurement' on shipping exception now works with more than... X-Git-Tag: 6.0.0-rc2-addons~127^2~79^2~2 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=ec217d2593fe1e7790e82b4a16bb9020f5894bbe;p=odoo%2Fodoo.git [IMP] sale:'Recreate procurement' on shipping exception now works with more than one sale order line bzr revid: mtr@mtr-20101124114151-mn9u8b0oyicaj0jr --- 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)