[MERGE] ability to add the currency information on name get of res.partner.bank object. Courtesy of Alexis de Lattre, Akretion

bzr revid: qdp-launchpad@openerp.com-20120711083357-b7guh7pi6wd5oucw
This commit is contained in:
Quentin (OpenERP)
2012-07-11 10:33:57 +02:00
+12 -1
View File
@@ -172,6 +172,17 @@ class res_partner_bank(osv.osv):
('required', field.required)]
return res
def _prepare_name_get(self, cr, uid, bank_type_obj, bank_obj, context=None):
"""
Format the name of a res.partner.bank.
This function is designed to be inherited to add replacement fields.
:param browse_record bank_type_obj: res.partner.bank.type object
:param browse_record bank_obj: res.partner.bank object
:rtype: str
:return: formatted name of a res.partner.bank record
"""
return bank_type_obj.format_layout % bank_obj._data[bank_obj.id]
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
@@ -187,7 +198,7 @@ class res_partner_bank(osv.osv):
# avoid the default format_layout to result in "False: ..."
if not val._data[val.id]['bank_name']:
val._data[val.id]['bank_name'] = _('BANK')
result = t.format_layout % val._data[val.id]
result = self._prepare_name_get(cr, uid, t, val, context=context)
except:
result += ' [Formatting Error]'
raise