[IMP] account: adapt _prepare_name_get() of res.partner.bank to its new api
bzr revid: rco@openerp.com-20120913114609-pff1x0spvb0gja2u
This commit is contained in:
parent
74df8d0147
commit
a44eb10af4
|
@ -43,11 +43,15 @@ class bank(osv.osv):
|
|||
"Return the name to use when creating a bank journal"
|
||||
return (bank.bank_name or '') + ' ' + bank.acc_number
|
||||
|
||||
def _prepare_name_get(self, cr, uid, bank_type_obj, bank_obj, context=None):
|
||||
"""Add ability to have %(currency_name)s in the format_layout of
|
||||
res.partner.bank.type"""
|
||||
bank_obj._data[bank_obj.id]['currency_name'] = bank_obj.currency_id and bank_obj.currency_id.name or ''
|
||||
return super(bank, self)._prepare_name_get(cr, uid, bank_type_obj, bank_obj, context=context)
|
||||
def _prepare_name_get(self, cr, uid, bank_dicts, context=None):
|
||||
"""Add ability to have %(currency_name)s in the format_layout of res.partner.bank.type"""
|
||||
currency_ids = list(set(data['currency_id'][0] for data in bank_dicts if data['currency_id']))
|
||||
currencies = self.pool.get('res.currency').browse(cr, uid, currency_ids, context=context)
|
||||
currency_name = dict((currency.id, currency.name) for currency in currencies)
|
||||
|
||||
for data in bank_dicts:
|
||||
data['currency_name'] = data['currency_id'] and currency_name[data['currency_id'][0]] or ''
|
||||
return super(bank, self)._prepare_name_get(cr, uid, bank_dicts, context=context)
|
||||
|
||||
def post_write(self, cr, uid, ids, context={}):
|
||||
if isinstance(ids, (int, long)):
|
||||
|
|
Loading…
Reference in New Issue