changeset 8a48ca85d1cd in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=8a48ca85d1cd
description:
        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
diffstat:

 move.py |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 1f6f7178e184 -r 8a48ca85d1cd move.py
--- a/move.py   Wed Aug 12 14:33:14 2020 +0200
+++ b/move.py   Wed Aug 12 22:02:26 2020 +0200
@@ -157,7 +157,8 @@
         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 @@
                 | 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.")

Reply via email to