From cc5b3d89d5bd0eb06a4bbbea2dbff9b8818d6498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Sep 2022 20:24:56 +0200 Subject: [PATCH] Invert boolean operator in search_shipments_returns issue11713 review439461003 --- common.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common.py b/common.py index baa835c83e..660e5c264f 100644 --- a/common.py +++ b/common.py @@ -31,9 +31,14 @@ def search_shipments_returns(model_name): @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 @@ def search_shipments_returns(model_name): target = 'rec_name' else: target = 'id' - return ['OR', + return [bool_op, domain, ('lines.components.moves.shipment.' + target,) + tuple(clause[1:3]) + (model_name,)]