[REF] l10n_fr_rib: refactored bank name_search as suggested by Olivier Dony (OpenERP)
[IMP] l10n_fr_rib: don't re-check error condition when constructing the message for key mismatch [FIx] l10n_fr_rib: wrong field name for bank code bzr revid: ls@numerigraphe.fr-20111128160001-q7re8fxr9lv2ad9g
This commit is contained in:
parent
6710f39da0
commit
a3229487ec
|
@ -61,7 +61,7 @@ class res_partner_bank(osv.osv):
|
||||||
if bank_id:
|
if bank_id:
|
||||||
bank = self.pool.get('res.bank').browse(cr, uid, bank_id,
|
bank = self.pool.get('res.bank').browse(cr, uid, bank_id,
|
||||||
context=context)
|
context=context)
|
||||||
result['bank_code'] = bank.code
|
result['bank_code'] = bank.rib_code
|
||||||
return {'value': result}
|
return {'value': result}
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
|
@ -74,8 +74,6 @@ class res_partner_bank(osv.osv):
|
||||||
|
|
||||||
def _construct_constraint_msg(self, cr, uid, ids, context=None):
|
def _construct_constraint_msg(self, cr, uid, ids, context=None):
|
||||||
"""Quote the data in the warning message"""
|
"""Quote the data in the warning message"""
|
||||||
if self._check_key(cr, uid, ids):
|
|
||||||
return
|
|
||||||
# Only process the first id
|
# Only process the first id
|
||||||
if type(ids) not in (int, long):
|
if type(ids) not in (int, long):
|
||||||
id = ids[0]
|
id = ids[0]
|
||||||
|
@ -100,17 +98,17 @@ class res_bank(osv.osv):
|
||||||
|
|
||||||
def name_search(self, cr, user, name, args=None, operator='ilike',
|
def name_search(self, cr, user, name, args=None, operator='ilike',
|
||||||
context=None, limit=80):
|
context=None, limit=80):
|
||||||
"""Search by bank code"""
|
"""Search by bank code in addition to the standard search"""
|
||||||
if args is None:
|
# Get the standard results
|
||||||
args = []
|
results = super(res_bank, self).name_search(cr, user,
|
||||||
ids = []
|
name, args=args ,operator=operator, context=context, limit=limit)
|
||||||
if name:
|
# Get additional results using the RIB code
|
||||||
ids = self.search(cr, user, [('name', operator, name)] + args,
|
ids = self.search(cr, user, [('rib_code', operator, name)],
|
||||||
limit=limit, context=context)
|
limit=limit, context=context)
|
||||||
if not ids:
|
# Merge the results
|
||||||
ids = self.search(cr, user, [('code', operator, name)] + args,
|
results = list(set(results + self.name_get(cr, user, ids, context)))
|
||||||
limit=limit, context=context)
|
print results
|
||||||
return self.name_get(cr, user, ids, context)
|
return results
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'rib_code': fields.char('RIB Bank Code', size=64),
|
'rib_code': fields.char('RIB Bank Code', size=64),
|
||||||
|
|
Loading…
Reference in New Issue