From f8f0ae56ef960f26a56c47551885a3cbf8f2ed17 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 16:57:44 +0200 Subject: [PATCH 1/5] [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']) + ] From eadab75188d90eb0310bff187d5ff5959ac043d4 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 20:34:44 +0200 Subject: [PATCH 2/5] [FIX] OpenERP version --- base_iban_bic_not_required/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py index 76497fccc..08695e9da 100644 --- a/base_iban_bic_not_required/__openerp__.py +++ b/base_iban_bic_not_required/__openerp__.py @@ -30,10 +30,10 @@ 'base_iban', ], 'description': ''' -The account_iban module in OpenERP 6.1 mandates the presence of a BIC +The account_iban module in OpenERP 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 +(see section 8 of [1]). This module reverts the constraint on BICs in the base_iban module. See also https://bugs.launchpad.net/openobject-addons/+bug/933472 From 529e93fbc135b50ac528958ee4b76f02911a1ff0 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sun, 28 Jul 2013 21:43:08 +0200 Subject: [PATCH 3/5] [RFR] Move remnant of earlier implementation to dedicated module --- account_banking/data/account_banking_data.xml | 7 ------- base_iban_bic_not_required/__openerp__.py | 3 +++ .../data/res_partner_bank_type_field.xml | 9 +++++++++ 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 base_iban_bic_not_required/data/res_partner_bank_type_field.xml diff --git a/account_banking/data/account_banking_data.xml b/account_banking/data/account_banking_data.xml index 3d47ad718..14ae6eafe 100644 --- a/account_banking/data/account_banking_data.xml +++ b/account_banking/data/account_banking_data.xml @@ -13,12 +13,5 @@ - - - - diff --git a/base_iban_bic_not_required/__openerp__.py b/base_iban_bic_not_required/__openerp__.py index 08695e9da..08a6fb582 100644 --- a/base_iban_bic_not_required/__openerp__.py +++ b/base_iban_bic_not_required/__openerp__.py @@ -40,5 +40,8 @@ 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 ''', + 'data': [ + 'data/res_partner_bank_type_field.xml', + ], 'installable': True, } diff --git a/base_iban_bic_not_required/data/res_partner_bank_type_field.xml b/base_iban_bic_not_required/data/res_partner_bank_type_field.xml new file mode 100644 index 000000000..274347a4d --- /dev/null +++ b/base_iban_bic_not_required/data/res_partner_bank_type_field.xml @@ -0,0 +1,9 @@ + + + + + + + + From 564d655bb178feafe2e5ab1225b7227e29a10d42 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sun, 28 Jul 2013 21:45:38 +0200 Subject: [PATCH 4/5] [FIX] Remove copy/paste comment --- base_iban_bic_not_required/model/res_partner_bank.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/base_iban_bic_not_required/model/res_partner_bank.py b/base_iban_bic_not_required/model/res_partner_bank.py index c1018c6c3..89d6d8d3e 100644 --- a/base_iban_bic_not_required/model/res_partner_bank.py +++ b/base_iban_bic_not_required/model/res_partner_bank.py @@ -30,8 +30,5 @@ class res_partner_bank(orm.Model): 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']) ] From b9981fbd5b1eeddce0e018b1d8d19490f25cb9a8 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Sun, 28 Jul 2013 21:50:27 +0200 Subject: [PATCH 5/5] [IMP] Inline documentation, line length --- base_iban_bic_not_required/model/res_partner_bank.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base_iban_bic_not_required/model/res_partner_bank.py b/base_iban_bic_not_required/model/res_partner_bank.py index 89d6d8d3e..126e628bd 100644 --- a/base_iban_bic_not_required/model/res_partner_bank.py +++ b/base_iban_bic_not_required/model/res_partner_bank.py @@ -29,6 +29,10 @@ class res_partner_bank(orm.Model): #workaround for lp:933472 return True + # Redefine constraint to update its function reference _constraints = [ - (_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['bic']) + (_check_bank, + '\nPlease define BIC/Swift code on bank for bank ' + 'type IBAN Account to make valid payments', + ['bic']) ]