From f8f0ae56ef960f26a56c47551885a3cbf8f2ed17 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 16:57:44 +0200 Subject: [PATCH] [ADD] Module base_iban_bic_not_required --- base_iban_bic_not_required/__init__.py | 1 + base_iban_bic_not_required/__openerp__.py | 44 +++++++++++++++++++ base_iban_bic_not_required/model/__init__.py | 1 + .../model/res_partner_bank.py | 37 ++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 base_iban_bic_not_required/__init__.py create mode 100644 base_iban_bic_not_required/__openerp__.py create mode 100644 base_iban_bic_not_required/model/__init__.py create mode 100644 base_iban_bic_not_required/model/res_partner_bank.py diff --git a/base_iban_bic_not_required/__init__.py b/base_iban_bic_not_required/__init__.py new file mode 100644 index 000000000..16e8b082f --- /dev/null +++ b/base_iban_bic_not_required/__init__.py @@ -0,0 +1 @@ +import model diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py new file mode 100644 index 000000000..76497fccc --- /dev/null +++ b/base_iban_bic_not_required/__openerp__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'IBAN - Bic not required', + 'version': '0.1', + 'license': 'AGPL-3', + 'author': 'Banking addons community', + 'website': 'https://launchpad.net/banking-addons', + 'category': 'Banking addons', + 'depends': [ + 'base_iban', + ], + 'description': ''' +The account_iban module in OpenERP 6.1 mandates the presence of a BIC +code on an IBAN account number through a constraint. However, as of +Februari 2012 there is a resolution from the EU that drops this requirement +(see section 8 of [1]). This module reverts the constraint on BICs from the +base_iban module. + +See also https://bugs.launchpad.net/openobject-addons/+bug/933472 + +[1] http://www.europarl.europa.eu/sides/getDoc.do?pubRef=-//EP//TEXT+TA+P7-TA-2012-0037+0+DOC+XML+V0//EN&language=EN#BKMD-9 + ''', + 'installable': True, +} diff --git a/base_iban_bic_not_required/model/__init__.py b/base_iban_bic_not_required/model/__init__.py new file mode 100644 index 000000000..3f2925496 --- /dev/null +++ b/base_iban_bic_not_required/model/__init__.py @@ -0,0 +1 @@ +import res_partner_bank diff --git a/base_iban_bic_not_required/model/res_partner_bank.py b/base_iban_bic_not_required/model/res_partner_bank.py new file mode 100644 index 000000000..c1018c6c3 --- /dev/null +++ b/base_iban_bic_not_required/model/res_partner_bank.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from openerp.osv import orm + + +class res_partner_bank(orm.Model): + _inherit = 'res.partner.bank' + + def _check_bank(self, cr, uid, ids, context=None): + #suppress base_iban's constraint to enforce BICs for IBANs + #workaround for lp:933472 + return True + + _constraints = [ + # Cannot have this as a constraint as it is rejecting valid numbers from GB and DE + # It works much better without this constraint! + #(check_iban, _("The IBAN number doesn't seem to be correct"), ["acc_number"]) + (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['bic']) + ]