Improve search_rec_name method of template

This commit is contained in:
jmartin 2016-04-11 16:47:17 +02:00
parent 3c4f48b18e
commit 3b790fd4e2
1 changed files with 9 additions and 2 deletions

View File

@ -40,8 +40,15 @@ class Template:
@classmethod
def search_rec_name(cls, name, clause):
return ['OR', super(Template, cls).search_rec_name(name, clause),
[('code',) + tuple(clause[1:])]]
domain = super(Template, cls).search_rec_name(name, clause)
if clause[1].startswith('!') or clause[1].startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
return [bool_op,
domain,
('code',) + tuple(clause[1:]),
]
def get_code(self, name):
if self.unique_variant: