From: Ludovic CHEVALIER Date: Sun, 8 Jan 2023 17:03:52 +0000 (+0100) Subject: [PYTHON][VIEW][TRANS] +rna and siren field for companies X-Git-Tag: production~1 X-Git-Url: https://git.cyclocoop.org/?p=burette%2Flhc.git;a=commitdiff_plain;h=6715fb4377124a7c6f15e57f2d77d3df377f81f3 [PYTHON][VIEW][TRANS] +rna and siren field for companies --- diff --git a/__openerp__.py b/__openerp__.py index d9179dd..7df6996 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # lhc module for OpenERP, Customize OpenERP for L'Heureux Cyclage Copyright -# (C) 2013-2022 L'Heureux Cyclage () +# (C) 2013-2023 L'Heureux Cyclage () # # This file is a part of lhc_custom_oe # @@ -33,6 +33,9 @@ Custom module for L'Heureux Cyclage - Customing for professionnal training activities; - Event management optimization; - Add some partners fields; + - RNA code and SIREN fields for company; + - Bikecoop activity start and end date; + - … - Budget module customization; - Add default values for name and ref fields in expenses lines based on products description; diff --git a/i18n/fr.po b/i18n/fr.po index 7b72691..89f6f45 100644 --- a/i18n/fr.po +++ b/i18n/fr.po @@ -6,15 +6,20 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 6.0.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-21 15:54+0000\n" -"PO-Revision-Date: 2022-10-21 18:20+0200\n" +"POT-Creation-Date: 2023-01-08 16:39+0000\n" +"PO-Revision-Date: 2023-01-08 17:41+0100\n" "Last-Translator: Ludovic CHEVALIER \n" "Language-Team: \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.1.1\n" +"X-Generator: Poedit 3.2.2\n" + +#. module: lhc +#: field:res.partner,rna:0 +msgid "RNA code" +msgstr "Numéro RNA" #. module: lhc #: field:res.partner,county_code:0 @@ -106,6 +111,16 @@ msgstr "Source de financement principale" msgid "Event Registration" msgstr "Inscriptions" +#. module: lhc +#: view:res.partner:0 +msgid "W123456789" +msgstr "W123456789" + +#. module: lhc +#: view:res.partner:0 +msgid "123456789" +msgstr "123456789" + #. module: lhc #: model:ir.module.category,description:lhc.module_category_lhc msgid "Customize OpenERP for L'Heureux Cyclage usages." @@ -133,6 +148,11 @@ msgstr "Autres informations" msgid "Customer" msgstr "Client" +#. module: lhc +#: field:res.partner,siren:0 +msgid "SIREN" +msgstr "SIREN" + #. module: lhc #: field:event.registration,funding_main:0 msgid "Main funding" @@ -207,7 +227,14 @@ msgstr "" #. module: lhc #: constraint:res.partner:0 msgid "Error: Bikecoop activity dates are inconsistent!" -msgstr "Erreur: les dates d'activités d'atelier sont incohérentes" +msgstr "Erreur: les dates d'activités d'atelier sont incohérentes!" + +#. module: lhc +#: constraint:res.partner:0 +msgid "Error: RNA code must begin with a \"W\" followed by exactly 9 digits." +msgstr "" +"Erreur: le numéro RNA doit commencer par \"W\" et être suivi d'exactement 9 " +"chiffres." #. module: lhc #: field:event.registration,fundings_others:0 @@ -224,15 +251,21 @@ msgstr "Durée en heures" msgid "L'Heureux Cyclage" msgstr "L'Heureux Cyclage" +#. module: lhc +#: constraint:res.partner:0 +msgid "Error: SIREN must take exactly 10 digits." +msgstr "" +"Erreur: Le numéro de SIREN doit exclusivement être composé de 10 chiffres." + #. module: lhc #: selection:event.registration,position:0 msgid "Invividual" msgstr "Individuel·le" #. module: lhc -#: model:ir.model,name:lhc.model_event_event -msgid "Event" -msgstr "Événement" +#: view:res.partner:0 +msgid "All Individual Members" +msgstr "Tou·tes les membres individuel·les" #. module: lhc #: view:res.partner:0 @@ -281,9 +314,9 @@ msgid "Volunteer" msgstr "Bénévole" #. module: lhc -#: view:res.partner:0 -msgid "All Individual Members" -msgstr "Tou·tes les membres individuel·les" +#: model:ir.model,name:lhc.model_event_event +msgid "Event" +msgstr "Événement" #. module: lhc #: view:res.partner:0 diff --git a/i18n/lhc.pot b/i18n/lhc.pot index cd8c356..e900348 100644 --- a/i18n/lhc.pot +++ b/i18n/lhc.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-21 15:54+0000\n" -"PO-Revision-Date: 2022-10-21 15:54+0000\n" +"POT-Creation-Date: 2023-01-08 16:39+0000\n" +"PO-Revision-Date: 2023-01-08 16:39+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: lhc +#: field:res.partner,rna:0 +msgid "RNA code" +msgstr "" + #. module: lhc #: field:res.partner,county_code:0 msgid "County code" @@ -101,6 +106,16 @@ msgstr "" msgid "Event Registration" msgstr "" +#. module: lhc +#: view:res.partner:0 +msgid "W123456789" +msgstr "" + +#. module: lhc +#: view:res.partner:0 +msgid "123456789" +msgstr "" + #. module: lhc #: model:ir.module.category,description:lhc.module_category_lhc msgid "Customize OpenERP for L'Heureux Cyclage usages." @@ -128,6 +143,11 @@ msgstr "" msgid "Customer" msgstr "" +#. module: lhc +#: field:res.partner,siren:0 +msgid "SIREN" +msgstr "" + #. module: lhc #: field:event.registration,funding_main:0 msgid "Main funding" @@ -200,6 +220,11 @@ msgstr "" msgid "Error: Bikecoop activity dates are inconsistent!" msgstr "" +#. module: lhc +#: constraint:res.partner:0 +msgid "Error: RNA code must begin with a \"W\" followed by exactly 9 digits." +msgstr "" + #. module: lhc #: field:event.registration,fundings_others:0 msgid "Others fundings origins" @@ -215,14 +240,19 @@ msgstr "" msgid "L'Heureux Cyclage" msgstr "" +#. module: lhc +#: constraint:res.partner:0 +msgid "Error: SIREN must take exactly 10 digits." +msgstr "" + #. module: lhc #: selection:event.registration,position:0 msgid "Invividual" msgstr "" #. module: lhc -#: model:ir.model,name:lhc.model_event_event -msgid "Event" +#: view:res.partner:0 +msgid "All Individual Members" msgstr "" #. module: lhc @@ -272,8 +302,8 @@ msgid "Volunteer" msgstr "" #. module: lhc -#: view:res.partner:0 -msgid "All Individual Members" +#: model:ir.model,name:lhc.model_event_event +msgid "Event" msgstr "" #. module: lhc diff --git a/lhc.py b/lhc.py index 27e1462..a862953 100644 --- a/lhc.py +++ b/lhc.py @@ -69,6 +69,38 @@ class res_partner(orm.Model): return False return True + def _rna_check(self, cr, uid, ids, context=None): + """Check if RNA code is well formatted""" + for partner in self.browse(cr, uid, ids, context=context): + if partner.rna: + if len(partner.rna) != 10: + return False + if partner.rna[0] != 'W': + return False + try: + int(partner.rna[1:10]) + except ValueError: + return False + return True + else: + return True + + + def _siren_check(self, cr, uid, ids, context=None): + """Check if SIREN code is well formatted""" + for partner in self.browse(cr, uid, ids, context=context): + if partner.siren: + if len(partner.siren) != 9: + return False + try: + int(partner.siren) + except ValueError: + return False + return True + else: + return True + + _columns = { 'usual_contact': fields.boolean( 'Usual contact', @@ -95,15 +127,18 @@ class res_partner(orm.Model): with this email. Only the main email can receive notifications."""), 'bikecoop_activity_start': fields.integer('Bikecoop activity start year'), 'bikecoop_activity_stop': fields.integer('Bikecoop activity end year'), + 'rna': fields.char('RNA code', size=10), + 'siren': fields.char('SIREN', size=9), } _defaults = { 'kit_sent': lambda *a: False, } - _constraints = [ (_bikecoop_activity_dates_check, 'Error: Bikecoop activity dates are inconsistent!', ['Bikecoop activity dates']), + (_rna_check, 'Error: RNA code must begin with a "W" followed by exactly 9 digits.', ['RNA']), + (_siren_check, 'Error: SIREN must take exactly 10 digits.', ['SIREN']), ] diff --git a/view/membership.xml b/view/membership.xml index a5078d0..49a347a 100644 --- a/view/membership.xml +++ b/view/membership.xml @@ -13,6 +13,8 @@ + +