_inherit = "res.partner.bank"
_columns = {
'journal_id': fields.many2one('account.journal', 'Account Journal', help="This journal will be created automatically for this bank account when you save the record"),
+ 'currency_id': fields.related('journal_id', 'currency', type="many2one", relation='res.currency', readonly=True,
+ string="Currency", help="Currency of the related account journal."),
}
def create(self, cr, uid, data, context={}):
result = super(bank, self).create(cr, uid, data, context=context)
"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 post_write(self, cr, uid, ids, context={}):
if isinstance(ids, (int, long)):
ids = [ids]
# Find the code and parent of the bank account to create
dig = 6
current_num = 1
- ids = obj_acc.search(cr, uid, [('type','=','liquidity')], context=context)
+ ids = obj_acc.search(cr, uid, [('type','=','liquidity'), ('company_id', '=', bank.company_id.id)], context=context)
# No liquidity account exists, no template available
if not ids: continue