[FIX] stock: Transfering the pack

When transfering the pack, the priority to the moves in state "assigned"
or partially_available(=true) must be given.

Used case (steps):

-set warehouse with three steps to delivery
-create one product A with qty on hand 10
-create sale order with first line product A by qty 2 and the second line with product A with qty 10
-confirm sale order
-check availability
-transfer pick by qty 10
-transfer pack by qty 10

The pack couldn't be transered

Now the pack is transfered.

Closes: #10764

opw:668682
This commit is contained in:
Goffin Simon 2016-03-15 13:45:50 +01:00
parent c824e50b3f
commit f66fcf97b2
1 changed files with 2 additions and 1 deletions

View File

@ -1268,7 +1268,8 @@ 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 [x for x in picking.move_lines if x.state not in ('done', 'cancel')]:
moves = sorted([x for x in picking.move_lines if x.state not in ('done', 'cancel')], key=lambda x: (((x.state == 'assigned') and -2 or 0) + (x.partially_available and -1 or 0)))
for move in moves:
if not prod2move_ids.get(move.product_id.id):
prod2move_ids[move.product_id.id] = [{'move': move, 'remaining_qty': move.product_qty}]
else: