[FIX] stock: do not consider moves which are done/canceled

These moves are not taken into account when remaining quantity is computed or packs are prepared
Fixes: #6030
opw: 631762
This commit is contained in:
Nicolas Martinelli 2015-04-02 12:52:59 +02:00 committed by Josse Colpaert
parent 2c865db504
commit 233ca1d562
1 changed files with 3 additions and 3 deletions

View File

@ -1042,7 +1042,7 @@ class stock_picking(osv.osv):
# If we encounter an UoM that is smaller than the default UoM or the one already chosen, use the new one instead.
product_uom = {} # Determines UoM used in pack operations
for move in picking.move_lines:
for move in [x for x in picking.move_lines if x.state not in ('done', 'cancel')]:
if not product_uom.get(move.product_id.id):
product_uom[move.product_id.id] = move.product_id.uom_id
if move.product_uom.id != move.product_id.uom_id.id and move.product_uom.factor > product_uom[move.product_id.id].factor:
@ -1125,7 +1125,7 @@ class stock_picking(osv.osv):
prevals[key[0]] = [val_dict]
# prevals var holds the operations in order to create them in the same order than the picking stock moves if possible
processed_products = set()
for move in picking.move_lines:
for move in [x for x in picking.move_lines if x.state not in ('done', 'cancel')]:
if move.product_id.id not in processed_products:
vals += prevals.get(move.product_id.id, [])
processed_products.add(move.product_id.id)
@ -1236,7 +1236,7 @@ class stock_picking(osv.osv):
prod2move_ids = {}
still_to_do = []
#make a dictionary giving for each product, the moves and related quantity that can be used in operation links
for move in picking.move_lines:
for move in [x for x in picking.move_lines if x.state not in ('done', 'cancel')]:
if not prod2move_ids.get(move.product_id.id):
prod2move_ids[move.product_id.id] = [{'move': move, 'remaining_qty': move.product_qty}]
else: