From 28d3869a42f0190d49738c4061ef4336a959583f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Wed, 4 Jan 2012 16:29:00 +0100 Subject: [PATCH] [IMP] l10n_fr_siret: check the length of SIREN and NAF (/home/afayolle/work/oerp/addons/trunk-l10n-fr-siret rev 5899) --- l10n_fr_siret/i18n/fr.po | 6 +++--- l10n_fr_siret/i18n/l10n_fr_siret.po | 2 +- l10n_fr_siret/partner.py | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/l10n_fr_siret/i18n/fr.po b/l10n_fr_siret/i18n/fr.po index 271033290..4828aaaa0 100644 --- a/l10n_fr_siret/i18n/fr.po +++ b/l10n_fr_siret/i18n/fr.po @@ -38,12 +38,12 @@ msgstr "Le numéro SIRET est l'identifiant officiel de l'établissement en Franc #. module: l10n_fr_siret #: help:res.partner,siren:0 msgid "The SIREN number is the official identity number of the company in France. It makes the first 9 digits of the SIRET number." -msgstr "Le numéro SIREN est l'identifiant officiel de la société en France. il compose les 9 premiers chiffres du numéro SIRET." +msgstr "Le numéro SIREN est l'identifiant officiel de la société en France. Il compose les 9 premiers chiffres du numéro SIRET." #. module: l10n_fr_siret #: help:res.partner,nic:0 -msgid "The NIC number is the official rank number of this office in the company in France. It is composed of the last 5 digits of the SIRET number." -msgstr "The NIC number is the official rank number of this office in the company in France. It is composed of the last 5 digits of the SIRET number." +msgid "The NIC number is the official rank number of this office in the company in France. It makes the last 5 digits of the SIRET number." +msgstr "Le numéro NIC est le numéro de rang officiel de cet établissement dans sa société en France. Il compose les 5 derniers chiffres du numéro SIRET." #. module: l10n_fr_siret #: field:res.partner,siret:0 diff --git a/l10n_fr_siret/i18n/l10n_fr_siret.po b/l10n_fr_siret/i18n/l10n_fr_siret.po index 4bf92e696..9b41df1ff 100644 --- a/l10n_fr_siret/i18n/l10n_fr_siret.po +++ b/l10n_fr_siret/i18n/l10n_fr_siret.po @@ -42,7 +42,7 @@ msgstr "" #. module: l10n_fr_siret #: help:res.partner,nic:0 -msgid "The NIC number is the official rank number of this office in the company in France. It is composed of the last 5 digits of the SIRET number." +msgid "The NIC number is the official rank number of this office in the company in France. It makes the last 5 digits of the SIRET number." msgstr "" #. module: l10n_fr_siret diff --git a/l10n_fr_siret/partner.py b/l10n_fr_siret/partner.py index 5ebeb846f..26a6a678f 100644 --- a/l10n_fr_siret/partner.py +++ b/l10n_fr_siret/partner.py @@ -50,12 +50,13 @@ class Partner(osv.osv): """Check the SIREN's and NIC's keys (last digits)""" for partner in self.browse(cr, uid, ids, context=None): if partner.nic: - # Check the NIC type - if not partner.nic.isdecimal(): + # Check the NIC type and length + if not partner.nic.isdecimal() or len(partner.nic)!=5: return False if partner.siren: - # Check the SIREN type and key + # Check the SIREN type, length and key if (not partner.siren.isdecimal() + or len(partner.siren)!=9 or not _check_luhn(partner.siren) ): return False # Check the NIC key (you need both SIREN and NIC to check it) @@ -71,8 +72,8 @@ class Partner(osv.osv): 'nic': fields.char('NIC', size=5, help="The NIC number is the official rank number " "of this office in the company in France. It " - "is composed of the last 5 digits of the " - "SIRET number."), + "makes the last 5 digits of the SIRET " + "number."), 'siret': fields.function(_get_siret, type="char", string='SIRET', method=True, size=14, store = {