diff --git a/location.py b/location.py index 5796e41d9f..4c08adbf5f 100644 --- a/location.py +++ b/location.py @@ -297,7 +297,11 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView): @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, (cls._rec_name,) + tuple(clause[1:]), ('code',) + tuple(clause[1:]), ]