Invert boolean operator when searching description with negative operator

Closes #14037
(grafted from ef07c70a3ebe93f2e6268ccde48445005d3cdff6)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2025-05-27 19:57:03 +02:00
1 parent 9f9668641a
commit d30799b43f
1 file changed
+8 -3
+8 -3
View File
@@ -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:]),
],
]