changeset c641e5674211 in modules/product_kit:6.0
details: 
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=c641e5674211
description:
        Invert boolean operator in search_shipments_returns

        issue11713
        review439461003
        (grafted from d31f8499c591d09854f35099cc05277cdb20b3b0)
diffstat:

 common.py |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 11fb297715b1 -r c641e5674211 common.py
--- a/common.py Fri Apr 15 23:28:03 2022 +0200
+++ b/common.py Sun Sep 25 20:24:56 2022 +0200
@@ -31,9 +31,14 @@
         @wraps(func)
         def wrapper(cls, name, clause):
             domain = func(cls, name, clause)
+            _, operator, operand, *extra = clause
+            if operator.startswith('!') or operator.startswith('not '):
+                bool_op = 'AND'
+            else:
+                bool_op = 'OR'
             nested = clause[0].lstrip(name)
             if nested:
-                return ['OR',
+                return [bool_op,
                     domain,
                     ('lines.components.moves.shipment' + nested,)
                     + tuple(clause[1:3]) + (model_name,) + tuple(clause[3:]),
@@ -43,7 +48,7 @@
                     target = 'rec_name'
                 else:
                     target = 'id'
-                return ['OR',
+                return [bool_op,
                     domain,
                     ('lines.components.moves.shipment.' + target,)
                     + tuple(clause[1:3]) + (model_name,)]

Reply via email to