Files
enterprise-addons/l10n_hk_hr_payroll/models/res_bank.py
T

17 lines
572 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.exceptions import ValidationError
class ResBank(models.Model):
_inherit = 'res.bank'
l10n_hk_bank_code = fields.Char(string='Bank Code', size=3)
@api.constrains('country', 'l10n_hk_bank_code')
def _check_l10n_hk_bank_code(self):
for bank in self:
if bank.country_code == 'HK' and len(bank.l10n_hk_bank_code or '') != 3:
raise ValidationError(bank.env._("Bank code length must be 3 letters."))