openerp-expert-accounting team mailing list archive
-
openerp-expert-accounting team
-
Mailing list archive
-
Message #01435
[Merge] lp:~numerigraphe/openobject-addons/trunk-rib into lp:openobject-addons
You have been requested to review the proposed merge of lp:~numerigraphe/openobject-addons/trunk-rib into lp:openobject-addons.
For more details, see:
https://code.launchpad.net/~numerigraphe/openobject-addons/trunk-rib/+merge/82886
In this branch, I humbly propose a new module l10n_fr_rib, allowing users to enter bank account details in RIB format.
This format is still very widespread in France, so I think this may be of use for numerous users.
This module existed in the community branch in v5.
--
https://code.launchpad.net/~numerigraphe/openobject-addons/trunk-rib/+merge/82886
Your team OpenERP Accounting Experts is requested to review the proposed merge of lp:~numerigraphe/openobject-addons/trunk-rib into lp:openobject-addons.
=== added directory 'l10n_fr_rib'
=== added file 'l10n_fr_rib/__init__.py'
--- l10n_fr_rib/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/__init__.py 2011-11-21 14:25:34 +0000
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import bank
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_rib/__openerp__.py'
--- l10n_fr_rib/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/__openerp__.py 2011-11-21 14:25:34 +0000
@@ -0,0 +1,37 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+ 'name': 'French RIB Bank Details',
+ '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.''',
+ '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:
=== added file 'l10n_fr_rib/bank.py'
--- l10n_fr_rib/bank.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/bank.py 2011-11-21 14:25:34 +0000
@@ -0,0 +1,148 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import string
+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"""
+ _inherit = "res.partner.bank"
+
+ def _check_key(self, cr, uid, ids):
+ print """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_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)
+ print rib
+ # 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'))
+ 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
+
+ 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,
+ 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 = {
+ '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"""
+ if self._check_key(cr, uid, ids):
+ return
+ # 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,
+ _construct_constraint_msg,
+ ["key"])]
+
+res_partner_bank()
+
+class res_bank(osv.osv):
+ """Add the bank code to make it easier to enter RIB data"""
+ _inherit = 'res.bank'
+
+ 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,
+ 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)
+
+ _columns = {
+ 'rib_code': fields.char('RIB Bank Code', size=64),
+ }
+res_bank()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_rib/bank_data.xml'
--- l10n_fr_rib/bank_data.xml 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/bank_data.xml 2011-11-21 14:25:34 +0000
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <!--
+ RIB bank details
+ -->
+ <record id="bank_rib" model="res.partner.bank.type">
+ <field name="name">RIB Bank Details</field>
+ <field name="code">rib</field>
+ </record>
+
+ <record id="rib_bank_code_field" model="res.partner.bank.type.field">
+ <field name="name">bank_code</field>
+ <field name="bank_type_id" ref="bank_rib"/>
+ <field eval="True" name="required"/>
+ <field eval="False" name="readonly"/>
+ </record>
+ <record id="rib_office_field" model="res.partner.bank.type.field">
+ <field name="name">office</field>
+ <field name="bank_type_id" ref="bank_rib"/>
+ <field eval="True" name="required"/>
+ <field eval="False" name="readonly"/>
+ </record>
+ <record id="bank_acc_number_field" model="res.partner.bank.type.field">
+ <field name="name">acc_number</field>
+ <field name="bank_type_id" ref="bank_rib"/>
+ <field eval="True" name="required"/>
+ <field eval="False" name="readonly"/>
+ <field name="size">11</field>
+ </record>
+ <record id="rib_key_field" model="res.partner.bank.type.field">
+ <field name="name">key</field>
+ <field name="bank_type_id" ref="bank_rib"/>
+ <field eval="True" name="required"/>
+ <field eval="False" name="readonly"/>
+ </record>
+ <record id="rib_bic_field" model="res.partner.bank.type.field">
+ <field name="name">bank_bic</field>
+ <field name="bank_type_id" ref="bank_rib"/>
+ <field name="required" eval="0"/>
+ </record>
+ </data>
+</openerp>
=== added file 'l10n_fr_rib/bank_view.xml'
--- l10n_fr_rib/bank_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/bank_view.xml 2011-11-21 14:25:34 +0000
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <!-- add the fields for French RIB to the partner form (subform)-->
+ <record id="view_partner_rib1_form" model="ir.ui.view">
+ <field name="name">res.partner.form.rib1.inherit</field>
+ <field name="model">res.partner</field>
+ <field name="inherit_id" ref="base.view_partner_form" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <field name="acc_number" position="before">
+ <newline />
+ <field name="bank_code" />
+ <field name="office" />
+ <newline />
+ </field>
+ </field>
+ </record>
+ <record id="view_partner_rib2_form" model="ir.ui.view">
+ <field name="name">res.partner.form.rib2.inherit</field>
+ <field name="model">res.partner</field>
+ <field name="inherit_id" ref="base.view_partner_form" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <field name="acc_number" position="after">
+ <field name="key" />
+ </field>
+ </field>
+ </record>
+
+ <!-- add the bank code-->
+ <record id="view_res_bank_form" model="ir.ui.view">
+ <field name="name">res.bank.form.rib.inherit</field>
+ <field name="model">res.bank</field>
+ <field name="inherit_id" ref="base.view_res_bank_form" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <field name="bic" position="before">
+ <field name="rib_code" />
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'l10n_fr_rib/i18n'
=== added file 'l10n_fr_rib/i18n/fr.po'
--- l10n_fr_rib/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/i18n/fr.po 2011-11-21 14:25:34 +0000
@@ -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"
+
=== added file 'l10n_fr_rib/i18n/l10n_fr_rib.pot'
--- l10n_fr_rib/i18n/l10n_fr_rib.pot 1970-01-01 00:00:00 +0000
+++ l10n_fr_rib/i18n/l10n_fr_rib.pot 2011-11-21 14:25:34 +0000
@@ -0,0 +1,112 @@
+# 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:36+0000\n"
+"PO-Revision-Date: 2011-11-21 12:36+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 ""
+
+#. 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
+#: model:res.partner.bank.type.field,name:l10n_fr_rib.rib_office_field
+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
+msgid "Office Code"
+msgstr ""
+
+#. module: l10n_fr_rib
+#: model:res.partner.bank.type,name:l10n_fr_rib.bank_rib
+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."
+msgstr ""
+
+#. module: l10n_fr_rib
+#: field:res.partner.bank,key:0
+msgid "Key"
+msgstr ""
+
+#. module: l10n_fr_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:ir.model,name:l10n_fr_rib.model_res_bank
+msgid "Bank"
+msgstr ""
+
+#. module: l10n_fr_rib
+#: model:res.partner.bank.type.field,name:l10n_fr_rib.bank_acc_number_field
+msgid "acc_number"
+msgstr ""
+
References