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
This commit is contained in:
bch 2007-04-13 13:33:23 +00:00
parent c5c3a7a3d9
commit d555e2511a
1 changed files with 7 additions and 4 deletions

View File

@ -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):