From 3d98f01646fc82233698d895170eadeaee459938 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Wed, 17 Jun 2009 09:27:15 +0200 Subject: [PATCH 02/13] [ADD] Added a module to easily enter RIBs (standard French bank details slips). bzr revid: ls@numerigraphe.fr-20090617072715-hdkf86qq0nskc5q7 --- addons/base_rib/__init__.py | 26 +++++++ addons/base_rib/__terp__.py | 40 +++++++++++ addons/base_rib/base_rib.py | 112 ++++++++++++++++++++++++++++++ addons/base_rib/base_rib_data.xml | 38 ++++++++++ addons/base_rib/base_rib_view.xml | 90 ++++++++++++++++++++++++ addons/base_rib/i18n/fr_FR.po | 81 +++++++++++++++++++++ 6 files changed, 387 insertions(+) create mode 100644 addons/base_rib/__init__.py create mode 100644 addons/base_rib/__terp__.py create mode 100644 addons/base_rib/base_rib.py create mode 100644 addons/base_rib/base_rib_data.xml create mode 100644 addons/base_rib/base_rib_view.xml create mode 100644 addons/base_rib/i18n/fr_FR.po diff --git a/addons/base_rib/__init__.py b/addons/base_rib/__init__.py new file mode 100644 index 00000000000..f715da6a386 --- /dev/null +++ b/addons/base_rib/__init__.py @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import base_rib + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/base_rib/__terp__.py b/addons/base_rib/__terp__.py new file mode 100644 index 00000000000..4712b449b9d --- /dev/null +++ b/addons/base_rib/__terp__.py @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'RIB', + 'version': '0.1', + 'category': 'Generic Modules/Base', + 'description': """ +This module install the base for RIB bank accounts (French standard for bank accounts). +To make it easier to enter RIB data, it will also allow to search for banks by code. + + """, + "author" : "Numérigraphe SARL", + 'depends': ['base', 'account'], + 'init_xml': ['base_rib_data.xml', ], + 'update_xml': ['base_rib_view.xml', ], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_rib/base_rib.py b/addons/base_rib/base_rib.py new file mode 100644 index 00000000000..34c86902a67 --- /dev/null +++ b/addons/base_rib/base_rib.py @@ -0,0 +1,112 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import string +import unicodedata + +import netsvc +from osv import fields, osv + +# Add fields and behavior for French RIB +class res_partner_bank(osv.osv): + _inherit = "res.partner.bank" + + def _check_key(self, cr, uid, ids): + ''' + Check the RIB key + ''' + for bank_acc in self.browse(cr, uid, ids): + # ignore the accounts of type other than rib + if bank_acc.state !='rib': + continue + + # Fail if the needed values are empty of too short + if (not bank_acc.bank or not bank_acc.bank.code or len(bank_acc.bank.code) != 5 + or not bank_acc.office or len(bank_acc.office) != 5 + or not bank_acc.acc_number or len(bank_acc.acc_number) != 11 + or not bank_acc.key or len(bank_acc.key) != 2): + return False + + # get the rib data (without the key) + rib = "%s%s%s" % (bank_acc.bank.code, bank_acc.office, bank_acc.acc_number) + # translate letters into numbers according to a specific table (notice how s -> 2) + # Note: maketrans and translate work best with latin1 - that should not be a problem for RIB data + rib = rib.lower().encode('latin-1').translate(string.maketrans(u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789')) + + # compute the key + key = 97 - (100 * int(rib)) % 97 + + if int(bank_acc.key) != key: + return False + return True + + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + #overwrite the search method in order to search not only on bank type == basic account number but also on type == rib + res = super(res_partner_bank, self).search(cr, uid, args, offset, limit, order, context=context, count=count) + if filter(lambda x:x[0] == 'acc_number' , args): + #get the value of the search + rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2] + #get the other arguments of the search + args1 = filter(lambda x:x[0] != 'acc_number' , args) + #add the new criterion + args1 += [('rib', 'ilike', rib_value)] + #append the results to the older search + res += super(res_partner_bank, self).search(cr, uid, args1, offset, limit, + order, context=context, count=count) + return res + + _columns = { + 'office': fields.char('Office Code', size=5, readonly=True, help="Office Code"), + 'key': fields.char('Key', size=2, readonly=True, help="The key is a number allowing to check the correctness of the other codes."), + } + + _constraints = [(_check_key, "The RIB key does not correspond to the other codes.", ["key"])] + +res_partner_bank() + +# overload the name_search method on banks to make it easier to enter RIB data +class res_bank(osv.osv): + _inherit = 'res.bank' + + # allow a search by code + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): + if not args: + args = [] + if context is None: + context = {} + ids = [] + if name: + ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) + if not ids: + ids = self.search(cr, user, [('code', operator, name)] + args, limit=limit, context=context) + return self.name_get(cr, user, ids, context) + + # show the code before the name + def name_get(self, cr, uid, ids, context=None): + result = [] + for bank in self.browse(cr, uid, ids, context): + result.append((bank.id, (bank.code and (bank.code + ' - ') or '') + bank.name)) + return result + +res_bank() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/base_rib/base_rib_data.xml b/addons/base_rib/base_rib_data.xml new file mode 100644 index 00000000000..40d57851912 --- /dev/null +++ b/addons/base_rib/base_rib_data.xml @@ -0,0 +1,38 @@ + + + + + + + RIB Bank Details + rib + + + bank + + + + + + office + + + + + + acc_number + + + + 11 + + + key + + + + + + diff --git a/addons/base_rib/base_rib_view.xml b/addons/base_rib/base_rib_view.xml new file mode 100644 index 00000000000..eacfaf1cb5b --- /dev/null +++ b/addons/base_rib/base_rib_view.xml @@ -0,0 +1,90 @@ + + + + + + res.partner.form.rib0.inherit + res.partner + + form + + + + + + res.partner.form.rib1.inherit + res.partner + + form + + + + + + + + + + + res.partner.form.rib2.inherit + res.partner + + form + + + + + + + + + diff --git a/addons/base_rib/i18n/fr_FR.po b/addons/base_rib/i18n/fr_FR.po new file mode 100644 index 00000000000..af12a611964 --- /dev/null +++ b/addons/base_rib/i18n/fr_FR.po @@ -0,0 +1,81 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_rib +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-06-16 14:15:16+0000\n" +"PO-Revision-Date: 2009-06-16 14:15:16+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +msgid "key" +msgstr "key" + +#. module: base_rib +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "XML non valide pour l'architecture de la vue" + +#. module: base_rib +#: model:ir.module.module,description:base_rib.module_meta_information +msgid "\n" +"This module install the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" +"\n" +" " +msgstr "\n" +"Ce module configure la base pour la saisie des RIB (Relevés d'Identité Bancaires) standards français. \n" +"Pour faciliter la saisie des RIB, il permet également une recherche des banques par code.\n" +"\n" +" " + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +msgid "office" +msgstr "Agence" + +#. module: base_rib +#: field:res.partner.bank,office:0 +#: help:res.partner.bank,office:0 +msgid "Office Code" +msgstr "Code agence" + +#. module: base_rib +#: model:res.partner.bank.type,name:base_rib.bank_rib +msgid "RIB Bank Details" +msgstr "Relevé d'identité bancaire (RIB)" + +#. module: base_rib +#: help:res.partner.bank,key:0 +msgid "The key is a number allowing to check the correctness of the other codes." +msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects." + +#. module: base_rib +#: field:res.partner.bank,key:0 +msgid "Key" +msgstr "Clé" + +#. module: base_rib +#: model:ir.module.module,shortdesc:base_rib.module_meta_information +msgid "RIB" +msgstr "RIB" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +msgid "bank" +msgstr "bank" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +msgid "acc_number" +msgstr "acc_number" + From cf00c7a7be240762baf092d30966a54a930d8df4 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Fri, 19 Jun 2009 10:28:35 +0200 Subject: [PATCH 03/13] Fixed licence for base_rib bzr revid: ls@numerigraphe.fr-20090619082835-b4vr0z9tojhpnk5a --- addons/base_rib/__init__.py | 4 +--- addons/base_rib/__terp__.py | 5 +---- addons/base_rib/base_rib.py | 4 +--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/addons/base_rib/__init__.py b/addons/base_rib/__init__.py index f715da6a386..b49b0bdb212 100644 --- a/addons/base_rib/__init__.py +++ b/addons/base_rib/__init__.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/addons/base_rib/__terp__.py b/addons/base_rib/__terp__.py index 4712b449b9d..30741be0543 100644 --- a/addons/base_rib/__terp__.py +++ b/addons/base_rib/__terp__.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +18,6 @@ # ############################################################################## - { 'name': 'RIB', 'version': '0.1', diff --git a/addons/base_rib/base_rib.py b/addons/base_rib/base_rib.py index 34c86902a67..69a9d2284f2 100644 --- a/addons/base_rib/base_rib.py +++ b/addons/base_rib/base_rib.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 297637f890a77b7b119698f56ca6264fac71b1aa Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Fri, 19 Jun 2009 13:54:17 +0200 Subject: [PATCH 04/13] [IMP] POT file for base_rib. bzr revid: ls@numerigraphe.fr-20090619115417-e14n1md5j9aakzmc --- addons/base_rib/i18n/base_rib.pot | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 addons/base_rib/i18n/base_rib.pot diff --git a/addons/base_rib/i18n/base_rib.pot b/addons/base_rib/i18n/base_rib.pot new file mode 100644 index 00000000000..393825233e5 --- /dev/null +++ b/addons/base_rib/i18n/base_rib.pot @@ -0,0 +1,77 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_rib +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-06-19 11:39:18+0000\n" +"PO-Revision-Date: 2009-06-19 11:39:18+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +msgid "key" +msgstr "" + +#. module: base_rib +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "" + +#. module: base_rib +#: model:ir.module.module,description:base_rib.module_meta_information +msgid "\n" +"This module install the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" +"\n" +" " +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +msgid "office" +msgstr "" + +#. module: base_rib +#: field:res.partner.bank,office:0 +#: help:res.partner.bank,office:0 +msgid "Office Code" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type,name:base_rib.bank_rib +msgid "RIB Bank Details" +msgstr "" + +#. module: base_rib +#: help:res.partner.bank,key:0 +msgid "The key is a number allowing to check the correctness of the other codes." +msgstr "" + +#. module: base_rib +#: field:res.partner.bank,key:0 +msgid "Key" +msgstr "" + +#. module: base_rib +#: model:ir.module.module,shortdesc:base_rib.module_meta_information +msgid "RIB" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +msgid "bank" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +msgid "acc_number" +msgstr "" + From 068650b67a468f930ad26d9d9be14308c880fb4b Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 21 Nov 2011 14:31:45 +0100 Subject: [PATCH 05/13] [IMP] renamed base_rib to l10n_fr_rib bzr revid: ls@numerigraphe.fr-20111121133145-gfmm5y7arl2tx9ix --- addons/{base_rib => l10n_fr_rib}/__init__.py | 2 +- addons/{base_rib => l10n_fr_rib}/__terp__.py | 4 +- .../base_rib.py => l10n_fr_rib/bank.py} | 0 .../bank_data.xml} | 0 .../bank_view.xml} | 0 .../{base_rib => l10n_fr_rib}/i18n/fr_FR.po | 38 +++++++++---------- .../i18n/l10n_fr_rib.pot} | 38 +++++++++---------- 7 files changed, 41 insertions(+), 41 deletions(-) rename addons/{base_rib => l10n_fr_rib}/__init__.py (98%) rename addons/{base_rib => l10n_fr_rib}/__terp__.py (94%) rename addons/{base_rib/base_rib.py => l10n_fr_rib/bank.py} (100%) rename addons/{base_rib/base_rib_data.xml => l10n_fr_rib/bank_data.xml} (100%) rename addons/{base_rib/base_rib_view.xml => l10n_fr_rib/bank_view.xml} (100%) rename addons/{base_rib => l10n_fr_rib}/i18n/fr_FR.po (68%) rename addons/{base_rib/i18n/base_rib.pot => l10n_fr_rib/i18n/l10n_fr_rib.pot} (61%) diff --git a/addons/base_rib/__init__.py b/addons/l10n_fr_rib/__init__.py similarity index 98% rename from addons/base_rib/__init__.py rename to addons/l10n_fr_rib/__init__.py index b49b0bdb212..801d6ad8945 100644 --- a/addons/base_rib/__init__.py +++ b/addons/l10n_fr_rib/__init__.py @@ -18,7 +18,7 @@ # ############################################################################## -import base_rib +import bank # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_rib/__terp__.py b/addons/l10n_fr_rib/__terp__.py similarity index 94% rename from addons/base_rib/__terp__.py rename to addons/l10n_fr_rib/__terp__.py index 30741be0543..43d3c995c24 100644 --- a/addons/base_rib/__terp__.py +++ b/addons/l10n_fr_rib/__terp__.py @@ -29,8 +29,8 @@ To make it easier to enter RIB data, it will also allow to search for banks by c """, "author" : "Numérigraphe SARL", 'depends': ['base', 'account'], - 'init_xml': ['base_rib_data.xml', ], - 'update_xml': ['base_rib_view.xml', ], + 'init_xml': ['bank_data.xml', ], + 'update_xml': ['bank_view.xml', ], 'installable': True, 'active': False, } diff --git a/addons/base_rib/base_rib.py b/addons/l10n_fr_rib/bank.py similarity index 100% rename from addons/base_rib/base_rib.py rename to addons/l10n_fr_rib/bank.py diff --git a/addons/base_rib/base_rib_data.xml b/addons/l10n_fr_rib/bank_data.xml similarity index 100% rename from addons/base_rib/base_rib_data.xml rename to addons/l10n_fr_rib/bank_data.xml diff --git a/addons/base_rib/base_rib_view.xml b/addons/l10n_fr_rib/bank_view.xml similarity index 100% rename from addons/base_rib/base_rib_view.xml rename to addons/l10n_fr_rib/bank_view.xml diff --git a/addons/base_rib/i18n/fr_FR.po b/addons/l10n_fr_rib/i18n/fr_FR.po similarity index 68% rename from addons/base_rib/i18n/fr_FR.po rename to addons/l10n_fr_rib/i18n/fr_FR.po index af12a611964..ba6ea1b4b33 100644 --- a/addons/base_rib/i18n/fr_FR.po +++ b/addons/l10n_fr_rib/i18n/fr_FR.po @@ -1,6 +1,6 @@ # Translation of OpenERP Server. # This file contains the translation of the following modules: -# * base_rib +# * l10n_fr_rib # msgid "" msgstr "" @@ -15,18 +15,18 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field msgid "key" msgstr "key" -#. module: base_rib +#. module: l10n_fr_rib #: constraint:ir.ui.view:0 msgid "Invalid XML for View Architecture!" msgstr "XML non valide pour l'architecture de la vue" -#. module: base_rib -#: model:ir.module.module,description:base_rib.module_meta_information +#. module: l10n_fr_rib +#: model:ir.module.module,description:l10n_fr_rib.module_meta_information msgid "\n" "This module install the base for RIB bank accounts (French standard for bank accounts). \n" "To make it easier to enter RIB data, it will also allow to search for banks by code.\n" @@ -38,44 +38,44 @@ msgstr "\n" "\n" " " -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_office_field msgid "office" msgstr "Agence" -#. module: base_rib +#. module: l10n_fr_rib #: field:res.partner.bank,office:0 #: help:res.partner.bank,office:0 msgid "Office Code" msgstr "Code agence" -#. module: base_rib -#: model:res.partner.bank.type,name:base_rib.bank_rib +#. module: l10n_fr_rib +#: model:res.partner.bank.type,name:l10n_fr_rib.bank_rib msgid "RIB Bank Details" msgstr "Relevé d'identité bancaire (RIB)" -#. module: base_rib +#. module: l10n_fr_rib #: help:res.partner.bank,key:0 msgid "The key is a number allowing to check the correctness of the other codes." msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects." -#. module: base_rib +#. module: l10n_fr_rib #: field:res.partner.bank,key:0 msgid "Key" msgstr "Clé" -#. module: base_rib -#: model:ir.module.module,shortdesc:base_rib.module_meta_information +#. module: l10n_fr_rib +#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information msgid "RIB" msgstr "RIB" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_field msgid "bank" msgstr "bank" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.bank_acc_number_field msgid "acc_number" msgstr "acc_number" diff --git a/addons/base_rib/i18n/base_rib.pot b/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot similarity index 61% rename from addons/base_rib/i18n/base_rib.pot rename to addons/l10n_fr_rib/i18n/l10n_fr_rib.pot index 393825233e5..8d73c6c3cd0 100644 --- a/addons/base_rib/i18n/base_rib.pot +++ b/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot @@ -1,6 +1,6 @@ # Translation of OpenERP Server. # This file contains the translation of the following modules: -# * base_rib +# * l10n_fr_rib # msgid "" msgstr "" @@ -15,18 +15,18 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field msgid "key" msgstr "" -#. module: base_rib +#. module: l10n_fr_rib #: constraint:ir.ui.view:0 msgid "Invalid XML for View Architecture!" msgstr "" -#. module: base_rib -#: model:ir.module.module,description:base_rib.module_meta_information +#. module: l10n_fr_rib +#: model:ir.module.module,description:l10n_fr_rib.module_meta_information msgid "\n" "This module install the base for RIB bank accounts (French standard for bank accounts). \n" "To make it easier to enter RIB data, it will also allow to search for banks by code.\n" @@ -34,44 +34,44 @@ msgid "\n" " " msgstr "" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_office_field msgid "office" msgstr "" -#. module: base_rib +#. module: l10n_fr_rib #: field:res.partner.bank,office:0 #: help:res.partner.bank,office:0 msgid "Office Code" msgstr "" -#. module: base_rib -#: model:res.partner.bank.type,name:base_rib.bank_rib +#. module: l10n_fr_rib +#: model:res.partner.bank.type,name:l10n_fr_rib.bank_rib msgid "RIB Bank Details" msgstr "" -#. module: base_rib +#. module: l10n_fr_rib #: help:res.partner.bank,key:0 msgid "The key is a number allowing to check the correctness of the other codes." msgstr "" -#. module: base_rib +#. module: l10n_fr_rib #: field:res.partner.bank,key:0 msgid "Key" msgstr "" -#. module: base_rib -#: model:ir.module.module,shortdesc:base_rib.module_meta_information +#. module: l10n_fr_rib +#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information msgid "RIB" msgstr "" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_field msgid "bank" msgstr "" -#. module: base_rib -#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.bank_acc_number_field msgid "acc_number" msgstr "" From 05afd356a21fa0d4d33723a3e574e6ed3b134aa1 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 21 Nov 2011 14:44:10 +0100 Subject: [PATCH 06/13] [IMP] code cleanup in l10n_fr_rib bzr revid: ls@numerigraphe.fr-20111121134410-7l1qq9q11o2w55ty --- addons/l10n_fr_rib/__init__.py | 13 +-- .../{__terp__.py => __openerp__.py} | 30 +++---- addons/l10n_fr_rib/bank.py | 81 +++++++++++-------- addons/l10n_fr_rib/bank_view.xml | 12 +-- 4 files changed, 76 insertions(+), 60 deletions(-) rename addons/l10n_fr_rib/{__terp__.py => __openerp__.py} (55%) diff --git a/addons/l10n_fr_rib/__init__.py b/addons/l10n_fr_rib/__init__.py index 801d6ad8945..bdaab364c54 100644 --- a/addons/l10n_fr_rib/__init__.py +++ b/addons/l10n_fr_rib/__init__.py @@ -1,19 +1,20 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (C) 2009 Numérigraphe SARL. +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################## diff --git a/addons/l10n_fr_rib/__terp__.py b/addons/l10n_fr_rib/__openerp__.py similarity index 55% rename from addons/l10n_fr_rib/__terp__.py rename to addons/l10n_fr_rib/__openerp__.py index 43d3c995c24..8c87e8c0a3b 100644 --- a/addons/l10n_fr_rib/__terp__.py +++ b/addons/l10n_fr_rib/__openerp__.py @@ -1,37 +1,37 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (C) 2009 Numérigraphe SARL. +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################## { - 'name': 'RIB', - 'version': '0.1', - 'category': 'Generic Modules/Base', - 'description': """ -This module install the base for RIB bank accounts (French standard for bank accounts). -To make it easier to enter RIB data, it will also allow to search for banks by code. - - """, - "author" : "Numérigraphe SARL", + 'name': 'French RIB Bank Details', + 'version': '1.0', + 'category': 'Localization/Account Charts', + 'description': ''' +This module installs the base for RIB bank accounts (French standard for bank accounts). +To make it easier to enter RIB data, it will also allow to search for banks by code.''', + 'author' : u'Numérigraphe SARL', 'depends': ['base', 'account'], 'init_xml': ['bank_data.xml', ], 'update_xml': ['bank_view.xml', ], 'installable': True, 'active': False, } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index 69a9d2284f2..ccd868d0da2 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -1,19 +1,20 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################## @@ -24,31 +25,36 @@ import unicodedata import netsvc from osv import fields, osv -# Add fields and behavior for French RIB class res_partner_bank(osv.osv): + """Add fields and behavior for French RIB""" _inherit = "res.partner.bank" def _check_key(self, cr, uid, ids): - ''' - Check the RIB key - ''' + """Check the RIB key""" for bank_acc in self.browse(cr, uid, ids): - # ignore the accounts of type other than rib + # Ignore the accounts of type other than rib if bank_acc.state !='rib': continue - # Fail if the needed values are empty of too short - if (not bank_acc.bank or not bank_acc.bank.code or len(bank_acc.bank.code) != 5 + if (not bank_acc.bank or not bank_acc.bank.code + or len(bank_acc.bank.code) != 5 or not bank_acc.office or len(bank_acc.office) != 5 or not bank_acc.acc_number or len(bank_acc.acc_number) != 11 or not bank_acc.key or len(bank_acc.key) != 2): return False - # get the rib data (without the key) - rib = "%s%s%s" % (bank_acc.bank.code, bank_acc.office, bank_acc.acc_number) - # translate letters into numbers according to a specific table (notice how s -> 2) - # Note: maketrans and translate work best with latin1 - that should not be a problem for RIB data - rib = rib.lower().encode('latin-1').translate(string.maketrans(u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789')) + # Get the rib data (without the key) + rib = "%s%s%s" % (bank_acc.bank.code, bank_acc.office, + bank_acc.acc_number) + # Translate letters into numbers according to a specific table + # (notice how s -> 2) + # Note: maketrans and translate work best with latin1 - that + # should not be a problem for RIB data + # XXX use dict((ord(a), b) for a, b in zip(intab, outtab)) + # and translate() + rib = rib.lower().encode('latin-1').translate( + string.maketrans(u'abcdefghijklmnopqrstuvwxyz', + u'12345678912345678923456789')) # compute the key key = 97 - (100 * int(rib)) % 97 @@ -57,9 +63,11 @@ class res_partner_bank(osv.osv): return False return True - def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - #overwrite the search method in order to search not only on bank type == basic account number but also on type == rib - res = super(res_partner_bank, self).search(cr, uid, args, offset, limit, order, context=context, count=count) + def search(self, cr, uid, args, offset=0, limit=None, order=None, + context=None, count=False): + """Search on type == rib""" + res = super(res_partner_bank, self).search(cr, uid, args, offset, + limit=limit, order=order, context=context, count=count) if filter(lambda x:x[0] == 'acc_number' , args): #get the value of the search rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2] @@ -68,16 +76,21 @@ class res_partner_bank(osv.osv): #add the new criterion args1 += [('rib', 'ilike', rib_value)] #append the results to the older search - res += super(res_partner_bank, self).search(cr, uid, args1, offset, limit, - order, context=context, count=count) + res += super(res_partner_bank, self).search(cr, uid, args1, offset, + limit, order, context=context, count=count) return res _columns = { - 'office': fields.char('Office Code', size=5, readonly=True, help="Office Code"), - 'key': fields.char('Key', size=2, readonly=True, help="The key is a number allowing to check the correctness of the other codes."), + 'office': fields.char('Office Code', size=5, readonly=True, + help="Office Code"), + 'key': fields.char('Key', size=2, readonly=True, + help="The key is a number allowing to check the " + "correctness of the other codes."), } - _constraints = [(_check_key, "The RIB key does not correspond to the other codes.", ["key"])] + _constraints = [(_check_key, + "The RIB key does not correspond to the other codes.", + ["key"])] res_partner_bank() @@ -86,23 +99,25 @@ class res_bank(osv.osv): _inherit = 'res.bank' # allow a search by code - def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): - if not args: + def name_search(self, cr, user, name, args=None, operator='ilike', + context=None, limit=80): + if args is None: args = [] - if context is None: - context = {} ids = [] if name: - ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) + ids = self.search(cr, user, [('name', operator, name)] + args, + limit=limit, context=context) if not ids: - ids = self.search(cr, user, [('code', operator, name)] + args, limit=limit, context=context) + ids = self.search(cr, user, [('code', operator, name)] + args, + limit=limit, context=context) return self.name_get(cr, user, ids, context) # show the code before the name def name_get(self, cr, uid, ids, context=None): result = [] for bank in self.browse(cr, uid, ids, context): - result.append((bank.id, (bank.code and (bank.code + ' - ') or '') + bank.name)) + result.append((bank.id, + (bank.code and (bank.code + ' - ') or '') + bank.name)) return result res_bank() diff --git a/addons/l10n_fr_rib/bank_view.xml b/addons/l10n_fr_rib/bank_view.xml index eacfaf1cb5b..c30f3233a23 100644 --- a/addons/l10n_fr_rib/bank_view.xml +++ b/addons/l10n_fr_rib/bank_view.xml @@ -45,8 +45,8 @@ - - + + @@ -58,7 +58,7 @@ form - + @@ -70,8 +70,8 @@ tree - - + + @@ -82,7 +82,7 @@ tree - + --> From 35abfd730b74df722d19cb8b51bb221e3e05db5c Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 21 Nov 2011 14:45:45 +0100 Subject: [PATCH 07/13] [FIX] Ported base_rib to current trunk (future 6.1) bzr revid: ls@numerigraphe.fr-20111121134545-j398sfjqno7yqyhl --- addons/l10n_fr_rib/__openerp__.py | 2 +- addons/l10n_fr_rib/bank.py | 52 +++++++---- addons/l10n_fr_rib/bank_data.xml | 12 ++- addons/l10n_fr_rib/bank_view.xml | 64 ++----------- addons/l10n_fr_rib/i18n/fr.po | 116 ++++++++++++++++++++++++ addons/l10n_fr_rib/i18n/fr_FR.po | 81 ----------------- addons/l10n_fr_rib/i18n/l10n_fr_rib.pot | 83 ++++++++++++----- 7 files changed, 230 insertions(+), 180 deletions(-) create mode 100644 addons/l10n_fr_rib/i18n/fr.po delete mode 100644 addons/l10n_fr_rib/i18n/fr_FR.po diff --git a/addons/l10n_fr_rib/__openerp__.py b/addons/l10n_fr_rib/__openerp__.py index 8c87e8c0a3b..16ae81fb431 100644 --- a/addons/l10n_fr_rib/__openerp__.py +++ b/addons/l10n_fr_rib/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'French RIB Bank Details', 'version': '1.0', - 'category': 'Localization/Account Charts', + 'category': 'Hidden', 'description': ''' This module installs the base for RIB bank accounts (French standard for bank accounts). To make it easier to enter RIB data, it will also allow to search for banks by code.''', diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index ccd868d0da2..d0dc0571899 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -24,6 +24,7 @@ import unicodedata import netsvc from osv import fields, osv +from tools.translate import _ class res_partner_bank(osv.osv): """Add fields and behavior for French RIB""" @@ -36,8 +37,8 @@ class res_partner_bank(osv.osv): if bank_acc.state !='rib': continue # Fail if the needed values are empty of too short - if (not bank_acc.bank or not bank_acc.bank.code - or len(bank_acc.bank.code) != 5 + if (not bank_acc.bank_code + or len(bank_acc.bank_code) != 5 or not bank_acc.office or len(bank_acc.office) != 5 or not bank_acc.acc_number or len(bank_acc.acc_number) != 11 or not bank_acc.key or len(bank_acc.key) != 2): @@ -80,27 +81,51 @@ class res_partner_bank(osv.osv): limit, order, context=context, count=count) return res + def onchange_bank_id(self, cr, uid, ids, bank_id, context=None): + """Change the bank code""" + result = super(res_partner_bank, self).onchange_bank_id(cr, uid, ids, bank_id, + context=context) + if bank_id: + bank = self.pool.get('res.bank').browse(cr, uid, bank_id, + context=context) + result['bank_code'] = bank.code + return {'value': result} + _columns = { - 'office': fields.char('Office Code', size=5, readonly=True, - help="Office Code"), + 'bank_code': fields.char('Bank Code', size=64, readonly=True,), + 'office': fields.char('Office Code', size=5, readonly=True,), 'key': fields.char('Key', size=2, readonly=True, help="The key is a number allowing to check the " "correctness of the other codes."), } + def _construct_constraint_msg(self, cr, uid, ids, context=None): + """Quote the data in the warning message""" + # Only process the first id + if type(ids) not in (int, long): + id = ids[0] + rib = self.browse(cr, uid, id, context=context) + if rib: + return (_("\nThe RIB key %s does not correspond to the other " + "codes: %s %s %s.") % + (rib.key, + rib.bank_code, + rib.office, + rib.acc_number) ) + _constraints = [(_check_key, - "The RIB key does not correspond to the other codes.", + _construct_constraint_msg, ["key"])] res_partner_bank() -# overload the name_search method on banks to make it easier to enter RIB data class res_bank(osv.osv): + """Add the bank code to make it easier to enter RIB data""" _inherit = 'res.bank' - # allow a search by code def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): + """Search by bank code""" if args is None: args = [] ids = [] @@ -111,15 +136,10 @@ class res_bank(osv.osv): ids = self.search(cr, user, [('code', operator, name)] + args, limit=limit, context=context) return self.name_get(cr, user, ids, context) - - # show the code before the name - def name_get(self, cr, uid, ids, context=None): - result = [] - for bank in self.browse(cr, uid, ids, context): - result.append((bank.id, - (bank.code and (bank.code + ' - ') or '') + bank.name)) - return result - + + _columns = { + 'rib_code': fields.char('RIB Bank Code', size=64), + } res_bank() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_fr_rib/bank_data.xml b/addons/l10n_fr_rib/bank_data.xml index 40d57851912..1dc9f4c88fd 100644 --- a/addons/l10n_fr_rib/bank_data.xml +++ b/addons/l10n_fr_rib/bank_data.xml @@ -3,14 +3,15 @@ RIB Bank Details rib - - bank + + + bank_code @@ -34,5 +35,10 @@ + + bank_bic + + + diff --git a/addons/l10n_fr_rib/bank_view.xml b/addons/l10n_fr_rib/bank_view.xml index c30f3233a23..56eb8393aef 100644 --- a/addons/l10n_fr_rib/bank_view.xml +++ b/addons/l10n_fr_rib/bank_view.xml @@ -2,15 +2,6 @@ - - res.partner.form.rib0.inherit - res.partner - - form - - - - res.partner.form.rib1.inherit res.partner @@ -19,7 +10,7 @@ - + @@ -36,55 +27,18 @@ - + + res.bank.form.rib.inherit + res.bank + form - - - - - + + - - res.partner.bank.form.rib2.inherit - res.partner.bank - - form - - - - - - - - - res.partner.bank.tree.rib1.inherit - res.partner.bank - - tree - - - - - - - - - res.partner.bank.tree.rib2.inherit - res.partner.bank - - tree - - - - - - --> diff --git a/addons/l10n_fr_rib/i18n/fr.po b/addons/l10n_fr_rib/i18n/fr.po new file mode 100644 index 00000000000..4057dafb803 --- /dev/null +++ b/addons/l10n_fr_rib/i18n/fr.po @@ -0,0 +1,116 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_fr_rib +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.1beta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-11-21 12:37+0000\n" +"PO-Revision-Date: 2011-11-21 12:37+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_fr_rib +#: constraint:res.partner.bank:0 +msgid "\n" +"Please define BIC/Swift code on bank for bank type IBAN Account to make valid payments" +msgstr "\n" +"Please define BIC/Swift code on bank for bank type IBAN Account to make valid payments" + +#. module: l10n_fr_rib +#: model:ir.model,name:l10n_fr_rib.model_res_partner_bank +msgid "Bank Accounts" +msgstr "Comptes bancaires" + +#. module: l10n_fr_rib +#: field:res.partner.bank,bank_code:0 +msgid "Bank Code" +msgstr "Code banque" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bic_field +msgid "bank_bic" +msgstr "bank_bic" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_office_field +msgid "office" +msgstr "Agence" + +#. module: l10n_fr_rib +#: field:res.bank,rib_code:0 +msgid "RIB Bank Code" +msgstr "Code banque RIB" + +#. module: l10n_fr_rib +#: model:ir.module.module,description:l10n_fr_rib.module_meta_information +msgid "\n" +"This module installs the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code." +msgstr "\n" +"Ce module installe la base pour les comptes bancaires RIB (norme française pour les n° de compte). \n" +"Pour faciliter la saisie des RIBs, il permet aussi de chercher les banques par code." + +#. module: l10n_fr_rib +#: field:res.partner.bank,office:0 +msgid "Office Code" +msgstr "Code agence" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type,name:l10n_fr_rib.bank_rib +msgid "RIB Bank Details" +msgstr "Relevé d'identité bancaire (RIB)" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_code_field +msgid "bank_code" +msgstr "bank_code" + +#. module: l10n_fr_rib +#: code:addons/l10n_fr_rib/bank.py:109 +#, python-format +msgid "\n" +"The RIB key %s does not correspond to the other codes: %s %s %s." +msgstr "\n" +"La clé RIB %s ne correspond pas aux autres codes : %s %s %s." + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field +msgid "key" +msgstr "key" + +#. module: l10n_fr_rib +#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information +msgid "French RIB Bank Details" +msgstr "Relevés d'identité bancaire français (RIB)" + +#. module: l10n_fr_rib +#: help:res.partner.bank,key:0 +msgid "The key is a number allowing to check the correctness of the other codes." +msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects." + +#. module: l10n_fr_rib +#: field:res.partner.bank,key:0 +msgid "Key" +msgstr "Clé" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type,format_layout:l10n_fr_rib.bank_rib +msgid "%(bank_name)s: %(acc_number)s" +msgstr "%(bank_name)s: %(acc_number)s" + +#. module: l10n_fr_rib +#: model:ir.model,name:l10n_fr_rib.model_res_bank +msgid "Bank" +msgstr "Banque" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.bank_acc_number_field +msgid "acc_number" +msgstr "acc_number" + diff --git a/addons/l10n_fr_rib/i18n/fr_FR.po b/addons/l10n_fr_rib/i18n/fr_FR.po deleted file mode 100644 index ba6ea1b4b33..00000000000 --- a/addons/l10n_fr_rib/i18n/fr_FR.po +++ /dev/null @@ -1,81 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * l10n_fr_rib -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 5.0.1\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2009-06-16 14:15:16+0000\n" -"PO-Revision-Date: 2009-06-16 14:15:16+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field -msgid "key" -msgstr "key" - -#. module: l10n_fr_rib -#: constraint:ir.ui.view:0 -msgid "Invalid XML for View Architecture!" -msgstr "XML non valide pour l'architecture de la vue" - -#. module: l10n_fr_rib -#: model:ir.module.module,description:l10n_fr_rib.module_meta_information -msgid "\n" -"This module install the base for RIB bank accounts (French standard for bank accounts). \n" -"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" -"\n" -" " -msgstr "\n" -"Ce module configure la base pour la saisie des RIB (Relevés d'Identité Bancaires) standards français. \n" -"Pour faciliter la saisie des RIB, il permet également une recherche des banques par code.\n" -"\n" -" " - -#. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_office_field -msgid "office" -msgstr "Agence" - -#. module: l10n_fr_rib -#: field:res.partner.bank,office:0 -#: help:res.partner.bank,office:0 -msgid "Office Code" -msgstr "Code agence" - -#. module: l10n_fr_rib -#: model:res.partner.bank.type,name:l10n_fr_rib.bank_rib -msgid "RIB Bank Details" -msgstr "Relevé d'identité bancaire (RIB)" - -#. module: l10n_fr_rib -#: help:res.partner.bank,key:0 -msgid "The key is a number allowing to check the correctness of the other codes." -msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects." - -#. module: l10n_fr_rib -#: field:res.partner.bank,key:0 -msgid "Key" -msgstr "Clé" - -#. module: l10n_fr_rib -#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information -msgid "RIB" -msgstr "RIB" - -#. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_field -msgid "bank" -msgstr "bank" - -#. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.bank_acc_number_field -msgid "acc_number" -msgstr "acc_number" - diff --git a/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot b/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot index 8d73c6c3cd0..5db922fe20f 100644 --- a/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot +++ b/addons/l10n_fr_rib/i18n/l10n_fr_rib.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.1\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2009-06-19 11:39:18+0000\n" -"PO-Revision-Date: 2009-06-19 11:39:18+0000\n" +"Project-Id-Version: OpenERP Server 6.1beta\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-11-21 12:36+0000\n" +"PO-Revision-Date: 2011-11-21 12:36+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,22 +16,24 @@ msgstr "" "Plural-Forms: \n" #. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field -msgid "key" -msgstr "" - -#. module: l10n_fr_rib -#: constraint:ir.ui.view:0 -msgid "Invalid XML for View Architecture!" -msgstr "" - -#. module: l10n_fr_rib -#: model:ir.module.module,description:l10n_fr_rib.module_meta_information +#: constraint:res.partner.bank:0 msgid "\n" -"This module install the base for RIB bank accounts (French standard for bank accounts). \n" -"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" -"\n" -" " +"Please define BIC/Swift code on bank for bank type IBAN Account to make valid payments" +msgstr "" + +#. module: l10n_fr_rib +#: model:ir.model,name:l10n_fr_rib.model_res_partner_bank +msgid "Bank Accounts" +msgstr "" + +#. module: l10n_fr_rib +#: field:res.partner.bank,bank_code:0 +msgid "Bank Code" +msgstr "" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bic_field +msgid "bank_bic" msgstr "" #. module: l10n_fr_rib @@ -39,9 +41,20 @@ msgstr "" msgid "office" msgstr "" +#. module: l10n_fr_rib +#: field:res.bank,rib_code:0 +msgid "RIB Bank Code" +msgstr "" + +#. module: l10n_fr_rib +#: model:ir.module.module,description:l10n_fr_rib.module_meta_information +msgid "\n" +"This module installs the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code." +msgstr "" + #. module: l10n_fr_rib #: field:res.partner.bank,office:0 -#: help:res.partner.bank,office:0 msgid "Office Code" msgstr "" @@ -50,6 +63,28 @@ msgstr "" msgid "RIB Bank Details" msgstr "" +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_code_field +msgid "bank_code" +msgstr "" + +#. module: l10n_fr_rib +#: code:addons/l10n_fr_rib/bank.py:109 +#, python-format +msgid "\n" +"The RIB key %s does not correspond to the other codes: %s %s %s." +msgstr "" + +#. module: l10n_fr_rib +#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_key_field +msgid "key" +msgstr "" + +#. module: l10n_fr_rib +#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information +msgid "French RIB Bank Details" +msgstr "" + #. module: l10n_fr_rib #: help:res.partner.bank,key:0 msgid "The key is a number allowing to check the correctness of the other codes." @@ -61,13 +96,13 @@ msgid "Key" msgstr "" #. module: l10n_fr_rib -#: model:ir.module.module,shortdesc:l10n_fr_rib.module_meta_information -msgid "RIB" +#: model:res.partner.bank.type,format_layout:l10n_fr_rib.bank_rib +msgid "%(bank_name)s: %(acc_number)s" msgstr "" #. module: l10n_fr_rib -#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_bank_field -msgid "bank" +#: model:ir.model,name:l10n_fr_rib.model_res_bank +msgid "Bank" msgstr "" #. module: l10n_fr_rib From c8152fd3972a65fd4c8d0df5749b25b0761bbe0a Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 21 Nov 2011 16:20:47 +0100 Subject: [PATCH 08/13] [IMP] remove debugging print statements bzr revid: ls@numerigraphe.fr-20111121152047-k5bphj2egef8nfuu --- addons/l10n_fr_rib/bank.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index cd8488f6dcd..ac67b536265 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -31,7 +31,7 @@ class res_partner_bank(osv.osv): _inherit = "res.partner.bank" def _check_key(self, cr, uid, ids): - print """Check the RIB key""" + """Check the RIB key""" for bank_acc in self.browse(cr, uid, ids): # Ignore the accounts of type other than rib if bank_acc.state !='rib': @@ -43,11 +43,9 @@ class res_partner_bank(osv.osv): or not bank_acc.acc_number or len(bank_acc.acc_number) != 11 or not bank_acc.key or len(bank_acc.key) != 2): return False - # Get the rib data (without the key) rib = "%s%s%s" % (bank_acc.bank_code, bank_acc.office, bank_acc.acc_number) - print rib # Translate letters into numbers according to a specific table # (notice how s -> 2) # Note: maketrans and translate work best with latin1 - that @@ -57,10 +55,8 @@ class res_partner_bank(osv.osv): rib = rib.lower().encode('latin-1').translate( string.maketrans(u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789')) - print rib # compute the key key = 97 - (100 * int(rib)) % 97 - print int(bank_acc.key), key if int(bank_acc.key) != key: return False return True From ddb1ec724faf2ca84b5d959c831f7f55ec587504 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 21 Nov 2011 16:35:39 +0100 Subject: [PATCH 09/13] [IMP] rewrote the translation tbale lookup without downgrading strings to latin-1 bzr revid: ls@numerigraphe.fr-20111121153539-a060b20nvvf6x2c7 --- addons/l10n_fr_rib/bank.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index ac67b536265..b1a285ef743 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -19,9 +19,6 @@ # ############################################################################## -import string -import unicodedata - import netsvc from osv import fields, osv from tools.translate import _ @@ -48,14 +45,10 @@ class res_partner_bank(osv.osv): bank_acc.acc_number) # Translate letters into numbers according to a specific table # (notice how s -> 2) - # Note: maketrans and translate work best with latin1 - that - # should not be a problem for RIB data - # XXX use dict((ord(a), b) for a, b in zip(intab, outtab)) - # and translate() - rib = rib.lower().encode('latin-1').translate( - string.maketrans(u'abcdefghijklmnopqrstuvwxyz', - u'12345678912345678923456789')) - # compute the key + table = dict((ord(a), b) for a, b in zip( + u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789')) + rib = rib.lower().translate(table) + # compute the key key = 97 - (100 * int(rib)) % 97 if int(bank_acc.key) != key: return False From 25f83943e19904a9358ad15fb59e6f26f2baffcf Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 15:43:48 +0100 Subject: [PATCH 10/13] =?UTF-8?q?[IMP]=20extensive=20module=20description?= =?UTF-8?q?=20[IMP]=20assign=20(c)=20back=20to=20Num=C3=A9rigraphe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lp bug: https://launchpad.net/bugs/387958 fixed bzr revid: ls@numerigraphe.fr-20111128144348-ccl8ays59rc2hvj2 --- addons/l10n_fr_rib/__init__.py | 2 +- addons/l10n_fr_rib/__openerp__.py | 17 ++++++++++++++--- addons/l10n_fr_rib/bank.py | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/addons/l10n_fr_rib/__init__.py b/addons/l10n_fr_rib/__init__.py index bdaab364c54..a061d3f40a2 100644 --- a/addons/l10n_fr_rib/__init__.py +++ b/addons/l10n_fr_rib/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/addons/l10n_fr_rib/__openerp__.py b/addons/l10n_fr_rib/__openerp__.py index 16ae81fb431..87614dfa01e 100644 --- a/addons/l10n_fr_rib/__openerp__.py +++ b/addons/l10n_fr_rib/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -24,8 +24,19 @@ 'version': '1.0', 'category': 'Hidden', 'description': ''' -This module installs the base for RIB bank accounts (French standard for bank accounts). -To make it easier to enter RIB data, it will also allow to search for banks by code.''', +This module lets users enter the banking details of Partners in the RIB format (French standard for bank accounts details). +RIB Bank Accounts can be entered in the "Accounting" tab of the Partner form by specifying the account type "RIB". The four standard RIB fields will then become mandatory: +- Bank Code +- Office Code +- Account number +- RIB key +As a safety measure, OpenERP will check the RIB key whenever a RIB is saved, and will refuse to record the data if the key is incorrect. Please bear in mind that this can only happen when the user presses the "save" button, for example on the Partner Form. +Since each bank account may relate to a Bank, users may enter the RIB Bank Code in the Bank form - it will the pre-fill the Bank Code on the RIB when they select the Bank. +To make this easier, this module will also let users find Banks using their RIB code. + +The module base_iban can be a useful addition to this module, because French banks are now progressively adopting the international IBAN format instead of the RIB format. +The RIB and IBAN codes for a single account can be entered by recording two Bank Accounts in OpenERP: the first with the type "RIB", the second with the type "IBAN". +''', 'author' : u'Numérigraphe SARL', 'depends': ['base', 'account'], 'init_xml': ['bank_data.xml', ], diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index b1a285ef743..22b1bad01e1 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as From 6710f39da0f85b43984d718be31ef201744ce729 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 16:10:16 +0100 Subject: [PATCH 11/13] [DEL] l10n_fr_rib: drop useless Bank Account search() overload bzr revid: ls@numerigraphe.fr-20111128151016-0z48km039apfq3q5 --- addons/l10n_fr_rib/bank.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index 22b1bad01e1..ea32bca4467 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -54,23 +54,6 @@ class res_partner_bank(osv.osv): return False return True - def search(self, cr, uid, args, offset=0, limit=None, order=None, - context=None, count=False): - """Search on type == rib""" - res = super(res_partner_bank, self).search(cr, uid, args, offset, - limit=limit, order=order, context=context, count=count) - if filter(lambda x:x[0] == 'acc_number' , args): - #get the value of the search - rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2] - #get the other arguments of the search - args1 = filter(lambda x:x[0] != 'acc_number' , args) - #add the new criterion - args1 += [('rib', 'ilike', rib_value)] - #append the results to the older search - res += super(res_partner_bank, self).search(cr, uid, args1, offset, - limit, order, context=context, count=count) - return res - def onchange_bank_id(self, cr, uid, ids, bank_id, context=None): """Change the bank code""" result = super(res_partner_bank, self).onchange_bank_id(cr, uid, ids, bank_id, From a3229487ec6ef480158263e07b8595c7bbdd0c9f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 17:00:01 +0100 Subject: [PATCH 12/13] [REF] l10n_fr_rib: refactored bank name_search as suggested by Olivier Dony (OpenERP) [IMP] l10n_fr_rib: don't re-check error condition when constructing the message for key mismatch [FIx] l10n_fr_rib: wrong field name for bank code bzr revid: ls@numerigraphe.fr-20111128160001-q7re8fxr9lv2ad9g --- addons/l10n_fr_rib/bank.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index ea32bca4467..4875dc33512 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -61,7 +61,7 @@ class res_partner_bank(osv.osv): if bank_id: bank = self.pool.get('res.bank').browse(cr, uid, bank_id, context=context) - result['bank_code'] = bank.code + result['bank_code'] = bank.rib_code return {'value': result} _columns = { @@ -74,8 +74,6 @@ class res_partner_bank(osv.osv): def _construct_constraint_msg(self, cr, uid, ids, context=None): """Quote the data in the warning message""" - if self._check_key(cr, uid, ids): - return # Only process the first id if type(ids) not in (int, long): id = ids[0] @@ -100,17 +98,17 @@ class res_bank(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): - """Search by bank code""" - if args is None: - args = [] - ids = [] - if name: - ids = self.search(cr, user, [('name', operator, name)] + args, + """Search by bank code in addition to the standard search""" + # Get the standard results + results = super(res_bank, self).name_search(cr, user, + name, args=args ,operator=operator, context=context, limit=limit) + # Get additional results using the RIB code + ids = self.search(cr, user, [('rib_code', operator, name)], limit=limit, context=context) - if not ids: - ids = self.search(cr, user, [('code', operator, name)] + args, - limit=limit, context=context) - return self.name_get(cr, user, ids, context) + # Merge the results + results = list(set(results + self.name_get(cr, user, ids, context))) + print results + return results _columns = { 'rib_code': fields.char('RIB Bank Code', size=64), From 64c50d804ca677c87bc35a61be113d5d56b0cef9 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 17:05:29 +0100 Subject: [PATCH 13/13] [IMP] remove print statement bzr revid: ls@numerigraphe.fr-20111128160529-f7nz0d3n0vqber8h --- addons/l10n_fr_rib/bank.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index 4875dc33512..6f7fe819d13 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -107,7 +107,6 @@ class res_bank(osv.osv): limit=limit, context=context) # Merge the results results = list(set(results + self.name_get(cr, user, ids, context))) - print results return results _columns = {