From d30799b43fd7262f4df7d2bbc307b55006174649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 27 May 2025 19:57:03 +0200 Subject: [PATCH] Invert boolean operator when searching description with negative operator Closes #14037 (grafted from ef07c70a3ebe93f2e6268ccde48445005d3cdff6) --HG-- branch : 7.0 --- modules/account/move.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/account/move.py b/modules/account/move.py index 36e5626e71..98288f3adc 100644 --- a/modules/account/move.py +++ b/modules/account/move.py @@ -64,9 +64,14 @@ class DescriptionOriginMixin: @classmethod def search_description_used(cls, name, clause): pool = Pool() - domain = ['OR', [ - ('description', '!=', None), - ('description', '!=', ''), + operator = clause[1] + if operator.startswith('!') or operator.startswith('not '): + bool_op, bool_desc_op, desc_op = 'AND', 'OR', '=' + else: + bool_op, bool_desc_op, desc_op = 'OR', 'AND', '!=' + domain = [bool_op, [bool_desc_op, + ('description', desc_op, None), + ('description', desc_op, ''), ('description', *clause[1:]), ], ]