Files
tryton/party.py
T
Cédric Krier 531725536e Fix search_rec_name for negative operator
In case of negative operator, each subclause must be composed with 'AND'.

issue4559
review12081002
2015-04-05 23:33:36 +02:00

27 lines
789 B
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.model import fields
__all__ = ['Party']
__metaclass__ = PoolMeta
class Party:
__name__ = 'party.party'
bank_accounts = fields.Many2Many('bank.account-party.party', 'owner',
'account', 'Bank Accounts')
@classmethod
def search_rec_name(cls, name, clause):
domain = super(Party, 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,
('bank_accounts',) + tuple(clause[1:]),
]