[PYTHON][VIEW][TRANS] +rna and siren field for companies
authorLudovic CHEVALIER <ludovic@beurresarrasin.net>
Sun, 8 Jan 2023 17:03:52 +0000 (18:03 +0100)
committerLudovic CHEVALIER <ludovic@beurresarrasin.net>
Wed, 29 Mar 2023 11:55:43 +0000 (13:55 +0200)
__openerp__.py
i18n/fr.po
i18n/lhc.pot
lhc.py
view/membership.xml

index d9179dd..7df6996 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    lhc module for OpenERP, Customize OpenERP for L'Heureux Cyclage Copyright
-#    (C) 2013-2022 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
+#    (C) 2013-2023 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
 #
 #    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;
index 7b72691..89f6f45 100644 (file)
@@ -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 <ludovic.chevalier@heureux-cyclage.org>\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
index cd8c356..e900348 100644 (file)
@@ -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 (file)
--- 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']),
     ]
 
 
index a5078d0..49a347a 100644 (file)
@@ -13,6 +13,8 @@
                     <field name="kit_sent" attrs="{'invisible': [('membership_state','not in', ('old', 'waiting', 'invoiced', 'free', 'paid'))]}"/>
                     <field name="bikecoop_activity_start" attrs="{'invisible': [('is_company','=', False)]}" />
                     <field name="bikecoop_activity_stop" attrs="{'invisible': [('is_company','=', False)]}"/>
+                    <field name="rna" placeholder="W123456789" attrs="{'invisible': [('is_company','=', False)]}"/>
+                    <field name="siren" placeholder="123456789" attrs="{'invisible': [('is_company','=', False)]}"/>
                 </xpath>
             </field>
         </record>