Files
bank-payment/account_payment_order/models/res_bank.py
Alexis de Lattre fbe4351dbe Port almost all modules to v10 (#305)
Port almost all modules to v10

* Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug #300)
2016-10-20 01:41:41 +02:00

23 lines
772 B
Python

# -*- coding: utf-8 -*-
# © 2015-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, api, _
from odoo.exceptions import ValidationError
class ResBank(models.Model):
_inherit = 'res.bank'
@api.multi
@api.constrains('bic')
def check_bic_length(self):
for bank in self:
if bank.bic and len(bank.bic) not in (8, 11):
raise ValidationError(_(
"A valid BIC contains 8 or 11 characters. The BIC '%s' "
"contains %d characters, so it is not valid.")
% (bank.bic, len(bank.bic)))
# starting from v9, on res.partner.bank bank_bic is a related of bank_id.bic