From 10fbce941aabe20cc467be12ac24f4bf70a92b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 12 Aug 2021 18:45:25 +0200 Subject: [PATCH] Allow to skip picking if output is the storage location The picked step is pointless in such case because there is no inventory moves. Also we must allow to fill packages in waiting. issue10620 review363611002 (grafted from 7695afdfb9ce5ab8ef49993ec8311a557e555647) --HG-- branch : 6.0 --- shipment.py | 19 ++++++++++++------- ...stock_shipment_out_same_storage_output.rst | 6 ++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/shipment.py b/shipment.py index 8bce00cb0e..ba9e71251c 100644 --- a/shipment.py +++ b/shipment.py @@ -1054,6 +1054,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): ('waiting', 'assigned'), ('waiting', 'picked'), ('assigned', 'picked'), + ('waiting', 'packed'), ('picked', 'packed'), ('packed', 'done'), ('assigned', 'waiting'), @@ -1091,16 +1092,20 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): 'depends': ['state'], }, 'pick': { - 'invisible': If(Eval('warehouse_storage') - == Eval('warehouse_output'), - ~Eval('state').in_(['assigned', 'waiting']), + 'invisible': If( + Eval('warehouse_storage') == Eval('warehouse_output'), + True, Eval('state') != 'assigned'), - 'depends': ['state', 'warehouse_storage', - 'warehouse_output'], + 'depends': [ + 'state', 'warehouse_storage', 'warehouse_output'], }, 'pack': { - 'invisible': Eval('state') != 'picked', - 'depends': ['state'], + 'invisible': If( + Eval('warehouse_storage') == Eval('warehouse_output'), + Eval('state') != 'waiting', + Eval('state') != 'picked'), + 'depends': [ + 'state', 'warehouse_storage', 'warehouse_output'], }, 'done': { 'invisible': Eval('state') != 'packed', diff --git a/tests/scenario_stock_shipment_out_same_storage_output.rst b/tests/scenario_stock_shipment_out_same_storage_output.rst index 5740e954f8..f390ab8281 100644 --- a/tests/scenario_stock_shipment_out_same_storage_output.rst +++ b/tests/scenario_stock_shipment_out_same_storage_output.rst @@ -79,10 +79,8 @@ Set the shipment state to waiting:: >>> len(shipment_out.inventory_moves) 0 -Assign the shipment:: - >>> shipment_out.click('pick') - >>> shipment_out.state - 'picked' +Pack the shipment:: + >>> shipment_out.click('pack') >>> shipment_out.state 'packed'