From d555e2511a187db84560f3af149fd32ccafb8f30 Mon Sep 17 00:00:00 2001 From: bch <> Date: Fri, 13 Apr 2007 13:33:23 +0000 Subject: [PATCH] Stock picking, bugfix on test_finnished : now if a move line contain a quantity of 0, the state is set to done automatically bzr revid: bch-4b351ac6841e44ab8cf3863252f1ff5fa74fbfd2 --- 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 7a96d543bd2..2f157085374 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -400,11 +400,14 @@ class stock_picking(osv.osv): return True def test_finnished(self, cr, uid, ids): - for id in ids: - cr.execute('select id,state from stock_move where picking_id=%d', (id,)) - for x in cr.fetchall(): - if x[1] not in ('done','cancel'): + move_ids=self.pool.get('stock.move').search(cr,uid,[('picking_id','in',ids)]) + + for move in self.pool.get('stock.move').browse(cr,uid,move_ids): + if move.state not in ('done','cancel') : + if move.product_qty != 0.0: return False + else: + move.write(cr,uid,[move.id],{'state':'done'}) return True def test_assigned(self, cr, uid, ids):