From a7affa630b82ca760616d145cb1f1c3e2e36f3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 12 Aug 2020 22:02:26 +0200 Subject: [PATCH] Do not enforce uom category on done or cancelled move The user can no more fix such move so we should not fail if the validation is triggered by the update of another field. issue9503 review319761002 --- move.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/move.py b/move.py index c657e167b5..6db4b58b09 100644 --- a/move.py +++ b/move.py @@ -157,7 +157,8 @@ class Move(Workflow, ModelSQL, ModelView): select=True, states=STATES, domain=[ ('type', '!=', 'service'), - If(Bool(Eval('product_uom_category')), + If(Bool(Eval('product_uom_category')) + & ~Eval('state').in_(['done', 'cancelled']), ('default_uom_category', '=', Eval('product_uom_category')), ()) ], @@ -172,7 +173,9 @@ class Move(Workflow, ModelSQL, ModelView): | Eval('unit_price')), }, domain=[ - ('category', '=', Eval('product_uom_category')), + If(~Eval('state').in_(['done', 'cancelled']), + ('category', '=', Eval('product_uom_category')), + ()), ], depends=['state', 'unit_price', 'product_uom_category'], help="The unit in which the quantity is specified.")