Improve search_rec_name methods

This commit is contained in:
jmartin 2016-04-11 17:52:09 +02:00
parent 27ad86f927
commit c552b190ac
1 changed files with 28 additions and 4 deletions

View File

@ -31,7 +31,13 @@ class ShipmentInReturn:
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
domain = super(ShipmentInReturn, 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:]),
('reference',) + tuple(clause[1:]),
]
@ -43,7 +49,13 @@ class ShipmentOut:
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
domain = super(ShipmentOut, 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:]),
('reference',) + tuple(clause[1:]),
]
@ -55,7 +67,13 @@ class ShipmentOutReturn:
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
domain = super(ShipmentOutReturn, 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:]),
('reference',) + tuple(clause[1:]),
]
@ -67,7 +85,13 @@ class ShipmentInternal:
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
domain = super(ShipmentInternal, 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:]),
('reference',) + tuple(clause[1:]),
]