changeset d83394404044 in modules/party:5.0
details: https://hg.tryton.org/modules/party?cmd=changeset&node=d83394404044
description:
        Use AND-ed clause when searching contact mechanism with negate operator

        issue10309
        review334201002
        (grafted from 04d89a6a8e573612c0d3c3355365175f3adc22ee)
diffstat:

 contact_mechanism.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 7f4a292e6242 -r d83394404044 contact_mechanism.py
--- a/contact_mechanism.py      Sat Apr 04 17:54:29 2020 +0200
+++ b/contact_mechanism.py      Thu Apr 22 23:50:08 2021 +0200
@@ -197,7 +197,11 @@
 
     @classmethod
     def search_rec_name(cls, name, clause):
-        return ['OR',
+        if clause[1].startswith('!') or clause[1].startswith('not '):
+            bool_op = 'AND'
+        else:
+            bool_op = 'OR'
+        return [bool_op,
             ('value',) + tuple(clause[1:]),
             ('value_compact',) + tuple(clause[1:]),
             ]

Reply via email to