From 09b756f0b0d770ece03a031b2212400a667c2519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 13 Jan 2017 20:06:42 +0100 Subject: [PATCH] Make outgoing moves readonly on packed and inventory on asssigned We should forbid to create new moves on those states because they will make the state inconsistent. issue6156 review32931002 --- shipment.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shipment.py b/shipment.py index ad29c3afec..39f168c7aa 100644 --- a/shipment.py +++ b/shipment.py @@ -856,7 +856,8 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): ('company', '=', Eval('company')), ], states={ - 'readonly': ((Eval('state').in_(['waiting', 'done', 'cancel'])) + 'readonly': ((Eval('state').in_( + ['waiting', 'packed', 'done', 'cancel'])) | ~Eval('warehouse') | ~Eval('customer')), }, depends=['state', 'warehouse', 'customer', 'warehouse_output', @@ -872,7 +873,7 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): ], states={ 'readonly': Eval('state').in_( - ['draft', 'packed', 'done', 'cancel']), + ['draft', 'assigned', 'packed', 'done', 'cancel']), }, depends=['state', 'warehouse', 'warehouse_storage', 'warehouse_output', 'company']),