From e237a7b6efa3334481a4e926e525726ea8d68540 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Sat, 29 Oct 2016 23:56:12 +0200 Subject: [PATCH] Test origin before using it in wait The origin is not required on moves of drop shipment. issue5937 review25711002 --- stock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stock.py b/stock.py index c28aa99ae1..64508bf45d 100644 --- a/stock.py +++ b/stock.py @@ -396,7 +396,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView): requests = [] for sub_lines in grouped_slice([m.origin.id for s in shipments - for m in s.supplier_moves]): + for m in s.supplier_moves if m.origin]): requests += PurchaseRequest.search([ ('purchase_line', 'in', list(sub_lines)), ]) @@ -409,6 +409,8 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView): to_save = [] for shipment in shipments: for move in shipment.supplier_moves: + if not move.origin: + continue sale_line = request2sline[pline2request[move.origin]] for move in sale_line.moves: if (move.state not in ('cancel', 'done')