From f66fcf97b244ed41a77cd9353e7cba34695c41b4 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 15 Mar 2016 13:45:50 +0100 Subject: [PATCH] [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 --- addons/stock/stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 0562f2fe289..ea8cf25beb6 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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: