From 2fe8efd42835515d9d7a6cc8e16a2bb9db311ec0 Mon Sep 17 00:00:00 2001 From: "Jay Vora (OpenERP)" Date: Mon, 11 Apr 2011 15:59:52 +0530 Subject: [PATCH] [FIX] Stock : System should not create duplicate moves while processing with chained locations lp bug: https://launchpad.net/bugs/722538 fixed bzr revid: jvo@tinyerp.com-20110411102952-9lhk38kshrp8ha2p --- addons/stock/stock.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index af1b783709e..f7d296a426e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2108,11 +2108,11 @@ class stock_move(osv.osv): todo = [] for move in self.browse(cr, uid, ids, context=context): - #print 'DONE MOVE', move.id, move.product_id.name, move.move_dest_id.id, move.state, move.move_dest_id and move.move_dest_id.state if move.state=="draft": todo.append(move.id) if todo: self.action_confirm(cr, uid, todo, context=context) + todo = [] for move in self.browse(cr, uid, ids, context=context): if move.state in ['done','cancel']: @@ -2135,10 +2135,13 @@ class stock_move(osv.osv): prodlot_id = partial_datas and partial_datas.get('move%s_prodlot_id' % (move.id), False) if prodlot_id: self.write(cr, uid, [move.id], {'prodlot_id': prodlot_id}, context=context) - if move.state not in ('confirmed','done'): - self.action_confirm(cr, uid, move_ids, context=context) + if move.state not in ('confirmed','done','assigned'): + todo.append(move.id) - self.write(cr, uid, move_ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) + if todo: + self.action_confirm(cr, uid, todo, context=context) + + self.write(cr, uid, move_ids, {'state': 'done', 'date': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) for id in move_ids: wf_service.trg_trigger(uid, 'stock.move', id, cr)