Improve search_rec_name method of electronic mail

This commit is contained in:
jmartin 2016-04-11 17:34:36 +02:00
parent f162f7f78e
commit 3f20b6dd9f
1 changed files with 7 additions and 1 deletions

View File

@ -549,7 +549,13 @@ class ElectronicMail(ModelSQL, ModelView):
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
domain = super(ElectronicMail, 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,
('subject',) + tuple(clause[1:]),
('from_',) + tuple(clause[1:]),
('to',) + tuple(clause[1:]),