Files
odoo-usability/base_usability_akretion/models/res_partner_bank.py
Alexis de Lattre bdf4a527de [MIG] account_usability_akretion to v18
Move code from account_usability_akretion to base_usability_akretion
2024-12-31 01:02:50 +01:00

25 lines
847 B
Python

# Copyright 2015-2024 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
# In the 'base' module, they didn't put any string, so the bank name is
# displayed as 'Name', which the string of the related field it
# points to
bank_name = fields.Char(string='Bank Name')
@api.depends('currency_id')
def _compute_display_name(self):
for acc in self:
name = acc.acc_number
if acc.currency_id:
name = f"{name} ({acc.currency_id.name})"
if acc.bank_id:
name = f"{name} - {acc.bank_id.name}"
acc.display_name = name