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
This commit is contained in:
Cédric Krier committed 2020-08-12 22:02:26 +02:00
1 parent ee95ce1b3d
commit a7affa630b
1 file changed
+5 -2
+5 -2
View File
@@ -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.")