Browse Source

[ADD] persons membership

16.0
RemiFr82 7 months ago
parent
commit
0a9cfb1ded
  1. 11
      ffck_commons/__manifest__.py
  2. 142
      ffck_commons/data/ffck_membership_type.xml
  3. 7
      ffck_commons/data/ffck_structure_type.xml
  4. 257
      ffck_commons/i18n/fr.po
  5. 1
      ffck_commons/models/__init__.py
  6. 84
      ffck_commons/models/ffck_membership_type.py
  7. 62
      ffck_commons/models/ffck_structure_type.py
  8. 98
      ffck_commons/models/res_partner.py
  9. 15
      ffck_commons/models/res_partner_age_range.py
  10. 4
      ffck_commons/security/ir.model.access.csv
  11. 106
      ffck_commons/views/ffck_membership_type.xml
  12. 52
      ffck_commons/views/ffck_structure_type.xml
  13. 86
      ffck_commons/views/res_partner.xml

11
ffck_commons/__manifest__.py

@ -13,25 +13,22 @@
"base", "base",
"contacts", "contacts",
"l10n_fr_association", "l10n_fr_association",
"partner_contact_age_range",
"partner_contact_birthdate",
"partner_contact_birthplace",
"partner_contact_gender",
"partner_contact_email2", "partner_contact_email2",
"partner_contact_nationality",
"partner_contact_personal_information_page",
"partner_contact_phones2", "partner_contact_phones2",
"partner_firstname",
], ],
"data": [ "data": [
# Base data # Base data
"data/ffck_structure_type.xml", "data/ffck_structure_type.xml",
# membership data after structure data to papulate M2M field
"data/ffck_membership_type.xml",
"data/res_partner.xml", "data/res_partner.xml",
"data/res_partner_age_range.xml", "data/res_partner_age_range.xml",
# Security # Security
"security/ir.model.access.csv", "security/ir.model.access.csv",
# Views # Views
"views/res_partner.xml", "views/res_partner.xml",
# res_partner first for config menu
"views/ffck_membership_type.xml",
"views/ffck_structure_type.xml", "views/ffck_structure_type.xml",
# Wizards # Wizards
# 'wizards/ir_model_wizard.xml', # 'wizards/ir_model_wizard.xml',

142
ffck_commons/data/ffck_membership_type.xml

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="ffck_membership_type_ca1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year competition adult</field>
<field name="short">CA1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="age_range">adult</field>
<field name="practice" eval="True" />
<field name="competition" eval="True" />
<field name="current_price">64</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_cj1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year competition young</field>
<field name="short">CJ1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="age_range">young</field>
<field name="practice" eval="True" />
<field name="competition" eval="True" />
<field name="current_price">42</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_la1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year leisure adult</field>
<field name="short">LA1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="age_range">adult</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">56</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_lj1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year leisure young</field>
<field name="short">LJ1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="age_range">young</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">22</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_a3m" model="ffck.membership.type" forcecreate="0">
<field name="name">3 months adult</field>
<field name="short">A3M</field>
<field name="duration">3</field>
<field name="unit">month</field>
<field name="age_range">adult</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">20</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_j3m" model="ffck.membership.type" forcecreate="0">
<field name="name">3 months young</field>
<field name="short">J3M</field>
<field name="duration">3</field>
<field name="unit">month</field>
<field name="age_range">young</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">10</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_sp1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year without practice</field>
<field name="short">SP1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="practice" eval="False" />
<field name="competition" eval="False" />
<field name="current_price">2</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_c1d" model="ffck.membership.type" forcecreate="0">
<field name="name">1 day competition Open</field>
<field name="short">C1D</field>
<field name="duration">1</field>
<field name="unit">day</field>
<field name="practice" eval="True" />
<field name="competition" eval="True" />
<field name="current_price">5</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck'),ref('ffck_commons.ffck_structure_type_crck'),ref('ffck_commons.ffck_structure_type_cdck'),ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_l1d" model="ffck.membership.type" forcecreate="0">
<field name="name">1 day leisure</field>
<field name="short">L1D</field>
<field name="duration">1</field>
<field name="unit">day</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">1</field>
<field name="structure_type_ids"
eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck'),ref('ffck_commons.ffck_structure_type_crck'),ref('ffck_commons.ffck_structure_type_cdck'),ref('ffck_commons.ffck_structure_type_club'),ref('ffck_commons.ffck_structure_type_agra'),ref('ffck_commons.ffck_structure_type_agrb')])]" />
</record>
<record id="ffck_membership_type_i1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year individual</field>
<field name="short">I1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">80</field>
<field name="structure_type_ids" eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck')])]" />
</record>
<record id="ffck_membership_type_sp1a" model="ffck.membership.type" forcecreate="0">
<field name="name">1 year special NC and WF</field>
<field name="short">SP1A</field>
<field name="duration">1</field>
<field name="unit">year</field>
<field name="practice" eval="True" />
<field name="competition" eval="False" />
<field name="current_price">5</field>
<field name="structure_type_ids" eval="[(6, 0, [ref('ffck_commons.ffck_structure_type_ffck')])]" />
</record>
</data>
</odoo>

7
ffck_commons/data/ffck_structure_type.xml

@ -6,12 +6,14 @@
<field name="name">Federation</field> <field name="name">Federation</field>
<field name="short">FFCK</field> <field name="short">FFCK</field>
<field name="scale">1</field> <field name="scale">1</field>
<field name="current_price">0</field>
</record> </record>
<record id="ffck_structure_type_crck" model="ffck.structure.type"> <record id="ffck_structure_type_crck" model="ffck.structure.type">
<field name="name">Regional Committee</field> <field name="name">Regional Committee</field>
<field name="short">CRCK</field> <field name="short">CRCK</field>
<field name="scale">2</field> <field name="scale">2</field>
<field name="current_price">0</field>
<field name="parent_id" ref="ffck_structure_type_ffck" /> <field name="parent_id" ref="ffck_structure_type_ffck" />
</record> </record>
@ -19,6 +21,7 @@
<field name="name">Departmental Committee</field> <field name="name">Departmental Committee</field>
<field name="short">CDCK</field> <field name="short">CDCK</field>
<field name="scale">3</field> <field name="scale">3</field>
<field name="current_price">0</field>
<field name="parent_id" ref="ffck_structure_type_crck" /> <field name="parent_id" ref="ffck_structure_type_crck" />
</record> </record>
@ -26,6 +29,7 @@
<field name="name">Affiliate member</field> <field name="name">Affiliate member</field>
<field name="short">CLUB</field> <field name="short">CLUB</field>
<field name="scale">4</field> <field name="scale">4</field>
<field name="current_price">320</field>
<field name="parent_id" ref="ffck_structure_type_cdck" /> <field name="parent_id" ref="ffck_structure_type_cdck" />
</record> </record>
@ -33,6 +37,7 @@
<field name="name">Type A agreed member</field> <field name="name">Type A agreed member</field>
<field name="short">AGRA</field> <field name="short">AGRA</field>
<field name="scale">4</field> <field name="scale">4</field>
<field name="current_price">320</field>
<field name="parent_id" ref="ffck_structure_type_cdck" /> <field name="parent_id" ref="ffck_structure_type_cdck" />
</record> </record>
@ -40,6 +45,7 @@
<field name="name">Type B agreed member</field> <field name="name">Type B agreed member</field>
<field name="short">AGRB</field> <field name="short">AGRB</field>
<field name="scale">4</field> <field name="scale">4</field>
<field name="current_price">320</field>
<field name="parent_id" ref="ffck_structure_type_cdck" /> <field name="parent_id" ref="ffck_structure_type_cdck" />
</record> </record>
@ -47,6 +53,7 @@
<field name="name">Conventioned member</field> <field name="name">Conventioned member</field>
<field name="short">CONV</field> <field name="short">CONV</field>
<field name="scale">4</field> <field name="scale">4</field>
<field name="current_price">0</field>
<field name="parent_id" ref="ffck_structure_type_cdck" /> <field name="parent_id" ref="ffck_structure_type_cdck" />
</record> </record>

257
ffck_commons/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0-20230613\n" "Project-Id-Version: Odoo Server 16.0-20230613\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-27 21:44+0000\n"
"PO-Revision-Date: 2024-05-27 21:44+0000\n"
"POT-Creation-Date: 2024-05-29 12:59+0000\n"
"PO-Revision-Date: 2024-05-29 12:59+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,6 +16,68 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: ffck_commons #. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_c1d
msgid "1 day competition Open"
msgstr "Carte 1 jour Compétition Open"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_l1d
msgid "1 day leisure"
msgstr "Carte 1 jour Loisir"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_ca1a
msgid "1 year competition adult"
msgstr "Carte 1 an Compétition Adulte"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_cj1a
msgid "1 year competition young"
msgstr "Carte 1 an Compétition Jeune"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_i1a
msgid "1 year individual"
msgstr "Carte 1 an individuelle"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_la1a
msgid "1 year leisure adult"
msgstr "Carte 1 an Loisir Adulte"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_lj1a
msgid "1 year leisure young"
msgstr "Carte 1 an Loisir Jeune"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_sp1a
msgid "1 year special NC and WF"
msgstr "Carte 1 an spéciale NC et WF"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_sp1a
msgid "1 year without practice"
msgstr "Carte 1 an sans pratique"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__first_membership_date
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__first_membership_date
msgid "1st membership"
msgstr "Première adhésion"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_a3m
msgid "3 months adult"
msgstr "Carte 3 mois Loisir Adulte"
#. module: ffck_commons
#: model:ffck.membership.type,name:ffck_commons.ffck_membership_type_j3m
msgid "3 months young"
msgstr "Carte 3 mois Loisir Jeune"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__active
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__active #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__active
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_age_range__active #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_age_range__active
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__active #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__active
@ -23,16 +85,39 @@ msgstr ""
msgid "Active" msgid "Active"
msgstr "Actif" msgstr "Actif"
#. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_membership_type__age_range__adult
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner_age_range__age_range__adult
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Adult"
msgstr "Adulte"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.res_partner_view_search_inherit_persons
msgid "Adults"
msgstr "Adultes"
#. module: ffck_commons #. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_club #: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_club
msgid "Affiliate member" msgid "Affiliate member"
msgstr "Membre affilié" msgstr "Membre affilié"
#. module: ffck_commons #. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
#: model_terms:ir.ui.view,arch_db:ffck_commons.res_partner_view_search_inherit_persons
msgid "Age range" msgid "Age range"
msgstr "Tranche d'âges" msgstr "Tranche d'âges"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__age_range
msgid "Age specific"
msgstr "Liée à l'âge"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Annual"
msgstr "Annuel"
#. module: ffck_commons #. module: ffck_commons
#: model:res.partner.age.range,name:ffck_commons.age_range_benjamin #: model:res.partner.age.range,name:ffck_commons.age_range_benjamin
msgid "Benjamin" msgid "Benjamin"
@ -55,6 +140,20 @@ msgstr "CRCK"
msgid "Cadet" msgid "Cadet"
msgstr "" msgstr ""
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__company_id
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__company_id
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_structure_type_view_search
msgid "Company"
msgstr "Société"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__competition
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Competition"
msgstr "Compétition"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model,name:ffck_commons.model_res_partner #: model:ir.model,name:ffck_commons.model_res_partner
msgid "Contact" msgid "Contact"
@ -71,15 +170,39 @@ msgid "Create a Contact in your address book"
msgstr "Créer un contact dans votre annuaire" msgstr "Créer un contact dans votre annuaire"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__create_uid
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__create_uid #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__create_uid
msgid "Created by" msgid "Created by"
msgstr "Créé par" msgstr "Créé par"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__create_date
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__create_date #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__create_date
msgid "Created on" msgid "Created on"
msgstr "Créé le" msgstr "Créé le"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__currency_id
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__currency_id
msgid "Currency"
msgstr "Devise"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__current_price
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__current_price
msgid "Current price"
msgstr "Prix actuel"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Daily"
msgstr "À la journée"
#. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_membership_type__unit__day
msgid "Day"
msgstr "Jour"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__3 #: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__3
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__3 #: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__3
@ -98,11 +221,17 @@ msgid "Departmental Committee"
msgstr "Comité Départemental" msgstr "Comité Départemental"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__display_name
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__display_name #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__display_name
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__display_name #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__display_name
msgid "Display Name" msgid "Display Name"
msgstr "Nom d'affichage" msgstr "Nom d'affichage"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__duration
msgid "Duration"
msgstr "Durée"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_partner_code
@ -128,6 +257,11 @@ msgstr "Code FFCK"
msgid "FFCK code editable" msgid "FFCK code editable"
msgstr "Code FFCK éditable" msgstr "Code FFCK éditable"
#. module: ffck_commons
#: model:ir.actions.act_window,name:ffck_commons.ffck_membership_type_action
msgid "FFCK license types"
msgstr "Types de licences"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_network #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_network
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_network #: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_network
@ -147,6 +281,7 @@ msgid "FFCK partner"
msgstr "FFCK" msgstr "FFCK"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model,name:ffck_commons.model_ffck_membership_type
#: model:ir.model,name:ffck_commons.model_ffck_structure_type #: model:ir.model,name:ffck_commons.model_ffck_structure_type
msgid "FFCK structure type" msgid "FFCK structure type"
msgstr "Type de structure" msgstr "Type de structure"
@ -161,6 +296,13 @@ msgstr "Types de structures"
msgid "Federation" msgid "Federation"
msgstr "Fédération" msgstr "Fédération"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__age_range
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_age_range__age_range
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__age_range
msgid "Global range"
msgstr "Tranche globale"
#. module: ffck_commons #. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base #: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Hierarchy" msgid "Hierarchy"
@ -173,6 +315,7 @@ msgid "Hierarchy element"
msgstr "Hiérarchie" msgstr "Hiérarchie"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__id
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__id #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__id
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__id #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__id
msgid "ID" msgid "ID"
@ -184,26 +327,53 @@ msgid "Junior"
msgstr "" msgstr ""
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type____last_update
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type____last_update #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type____last_update
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy____last_update #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "Dernière modification le" msgstr "Dernière modification le"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__write_uid
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__write_uid #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "Dernière modification par" msgstr "Dernière modification par"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__write_date
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__write_date #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "Dernière mise à jour le" msgstr "Dernière mise à jour le"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__last_membership_date
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__last_membership_date
msgid "Last membership"
msgstr "Dernière adhésion"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Leisure"
msgstr "Loisir"
#. module: ffck_commons #. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_partner_form_inherit_base #: model_terms:ir.ui.view,arch_db:ffck_commons.view_partner_form_inherit_base
msgid "License code" msgid "License code"
msgstr "N° de licence" msgstr "N° de licence"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_membership_type_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_membership_type_id
#: model_terms:ir.ui.view,arch_db:ffck_commons.res_partner_view_search_inherit_persons
msgid "License type"
msgstr "Type de licence"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__membership_type_ids
#: model:ir.ui.menu,name:ffck_commons.ffck_membership_type_menu
msgid "License types"
msgstr "Types de licence"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__5 #: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__5
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__5 #: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__5
@ -249,6 +419,17 @@ msgid "Minime"
msgstr "" msgstr ""
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_membership_type__unit__month
msgid "Month"
msgstr "Mois"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Monthly"
msgstr "Au mois"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__name
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__name #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__name
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_age_range__name #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_age_range__name
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__name #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__name
@ -266,6 +447,11 @@ msgstr "Nationale"
msgid "Network" msgid "Network"
msgstr "Réseau fédéral" msgstr "Réseau fédéral"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "No practice"
msgstr "Sans pratique"
#. module: ffck_commons #. module: ffck_commons
#: model_terms:ir.actions.act_window,help:ffck_commons.action_persons #: model_terms:ir.actions.act_window,help:ffck_commons.action_persons
msgid "Odoo helps you track all activities related to your contacts." msgid "Odoo helps you track all activities related to your contacts."
@ -274,6 +460,7 @@ msgstr "Odoo vous aide à suivre les activités liées à vos contacts"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__parent_id #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__parent_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__parent_id #: model:ir.model.fields,field_description:ffck_commons.field_res_partner_hierarchy__parent_id
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_structure_type_view_search
msgid "Parent" msgid "Parent"
msgstr "" msgstr ""
@ -294,7 +481,6 @@ msgstr "Hiérarchie des partenaires"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.actions.act_window,name:ffck_commons.action_persons #: model:ir.actions.act_window,name:ffck_commons.action_persons
#: model:ir.ui.menu,name:ffck_commons.res_partner_menu_persons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base #: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Persons" msgid "Persons"
msgstr "Personnes" msgstr "Personnes"
@ -304,6 +490,21 @@ msgstr "Personnes"
msgid "Poussin" msgid "Poussin"
msgstr "" msgstr ""
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__practice
msgid "Practice"
msgstr "Pratique"
#. module: ffck_commons
#: model:ir.model.fields,help:ffck_commons.field_ffck_membership_type__current_price
msgid "Price at which the license is currently sold."
msgstr "Prix auquel la licence est actuellement vendue."
#. module: ffck_commons
#: model:ir.model.fields,help:ffck_commons.field_ffck_structure_type__current_price
msgid "Price at which the membership is currently sold."
msgstr "Prix auquel l'adhésion est actuellement vendue."
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__2 #: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__2
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__2 #: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__2
@ -325,25 +526,16 @@ msgstr "Comité Régional"
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__scale #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__scale
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__partner_scale #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__partner_scale
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__partner_scale #: model:ir.model.fields,field_description:ffck_commons.field_res_users__partner_scale
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_structure_type_view_search
msgid "Scale" msgid "Scale"
msgstr "Échelle" msgstr "Échelle"
#. module: ffck_commons #. module: ffck_commons
#: model:res.partner.age.range,name:ffck_commons.age_range_senior
msgid "Senior"
msgstr ""
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__short
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__short #: model:ir.model.fields,field_description:ffck_commons.field_ffck_structure_type__short
msgid "Short" msgid "Short"
msgstr "Initiales" msgstr "Initiales"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__first_membership_date
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__first_membership_date
msgid "Structure 1st membership"
msgstr "Première adhésion"
#. module: ffck_commons #. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_partner_form_inherit_base #: model_terms:ir.ui.view,arch_db:ffck_commons.view_partner_form_inherit_base
msgid "Structure code" msgid "Structure code"
@ -367,6 +559,7 @@ msgid "Structure type"
msgstr "Type de structure" msgstr "Type de structure"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__structure_type_ids
#: model:ir.ui.menu,name:ffck_commons.ffck_structure_type_menu #: model:ir.ui.menu,name:ffck_commons.ffck_structure_type_menu
msgid "Structure types" msgid "Structure types"
msgstr "Types de structure" msgstr "Types de structure"
@ -376,6 +569,17 @@ msgstr "Types de structure"
msgid "Structures" msgid "Structures"
msgstr "" msgstr ""
#. module: ffck_commons
#: model:res.partner.age.range,name:ffck_commons.age_range_senior
msgid "Sénior"
msgstr ""
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_ffck_membership_type__unit
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Time unit"
msgstr "Unité de temps"
#. module: ffck_commons #. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_agra #: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_agra
msgid "Type A agreed member" msgid "Type A agreed member"
@ -386,6 +590,12 @@ msgstr "Membre agréé Type A"
msgid "Type B agreed member" msgid "Type B agreed member"
msgstr "Membre agréé Type B" msgstr "Membre agréé Type B"
#. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__last_membership_validity
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__last_membership_validity
msgid "Validity"
msgstr "Validité"
#. module: ffck_commons #. module: ffck_commons
#: model:res.partner.age.range,name:ffck_commons.age_range_veteran1 #: model:res.partner.age.range,name:ffck_commons.age_range_veteran1
msgid "Vétéran 1" msgid "Vétéran 1"
@ -410,3 +620,20 @@ msgstr ""
#: model:res.partner.age.range,name:ffck_commons.age_range_veteran5 #: model:res.partner.age.range,name:ffck_commons.age_range_veteran5
msgid "Vétéran 5" msgid "Vétéran 5"
msgstr "" msgstr ""
#. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_membership_type__unit__year
msgid "Year"
msgstr "An"
#. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_membership_type__age_range__young
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner_age_range__age_range__young
#: model_terms:ir.ui.view,arch_db:ffck_commons.ffck_membership_type_view_search
msgid "Young"
msgstr "Jeune"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.res_partner_view_search_inherit_persons
msgid "Youngs"
msgstr "Jeunes"

1
ffck_commons/models/__init__.py

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import ffck_membership_type
from . import ffck_structure_type from . import ffck_structure_type
from . import res_partner from . import res_partner
from . import res_partner_age_range from . import res_partner_age_range

84
ffck_commons/models/ffck_membership_type.py

@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
RANGES = [
("young", "Young"),
("adult", "Adult"),
]
UNITS = [
("day", "Day"),
("month", "Month"),
("year", "Year"),
]
class FfckMembershipType(models.Model):
_name = "ffck.membership.type"
_description = "FFCK structure type"
_order = (
"unit desc, duration desc, age_range, competition desc, practice desc, name, id"
)
active = fields.Boolean(
string="Active",
default=True,
)
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
required=True,
default=lambda self: self.env.company,
)
currency_id = fields.Many2one(
comodel_name="res.currency",
related="company_id.currency_id",
string="Currency",
readonly=True,
)
name = fields.Char(
string="Name",
required=True,
translate=True,
)
short = fields.Char(
string="Short",
required=True,
index=True,
)
duration = fields.Integer(
string="Duration",
required=True,
default=1,
)
unit = fields.Selection(
selection=UNITS,
string="Time unit",
required=True,
default="year",
)
age_range = fields.Selection(
selection=RANGES,
string="Age specific",
)
practice = fields.Boolean(
string="Practice",
default=True,
)
competition = fields.Boolean(
string="Competition",
default=False,
)
current_price = fields.Float(
string="Current price",
default=1.0,
digits="Product Price",
help="Price at which the license is currently sold.",
)
structure_type_ids = fields.Many2many(
comodel_name="ffck.structure.type",
column1="membership_id",
column2="structure_type_id",
relation="membership_structure_type_rel",
string="Structure types",
)

62
ffck_commons/models/ffck_structure_type.py

@ -1,13 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from odoo import models, fields from odoo import models, fields
SCALES = [
("1", "National"),
("2", "Regional"),
("3", "Departmental"),
("4", "Local"),
("5", "Licensee"),
]
from .res_partner import SCALES
class FfckStructureType(models.Model): class FfckStructureType(models.Model):
@ -15,8 +8,51 @@ class FfckStructureType(models.Model):
_description = "FFCK structure type" _description = "FFCK structure type"
_order = "scale, short, name, id" _order = "scale, short, name, id"
name = fields.Char("Name", required=True, translate=True)
short = fields.Char("Short", required=True, index=True)
scale = fields.Selection(selection=SCALES, string="Scale", required=True)
active = fields.Boolean(string="Active", default=True)
parent_id = fields.Many2one(comodel_name="ffck.structure.type", string="Parent")
active = fields.Boolean(
string="Active",
default=True,
)
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
required=True,
default=lambda self: self.env.company,
)
currency_id = fields.Many2one(
comodel_name="res.currency",
related="company_id.currency_id",
string="Currency",
readonly=True,
)
name = fields.Char(
"Name",
required=True,
translate=True,
)
short = fields.Char(
"Short",
required=True,
index=True,
)
scale = fields.Selection(
selection=SCALES,
string="Scale",
required=True,
)
parent_id = fields.Many2one(
comodel_name="ffck.structure.type",
string="Parent",
)
current_price = fields.Float(
string="Current price",
default=0.0,
digits="Product Price",
help="Price at which the membership is currently sold.",
)
membership_type_ids = fields.Many2many(
comodel_name="ffck.membership.type",
column1="structure_type_id",
column2="membership_id",
relation="membership_structure_type_rel",
string="License types",
)

98
ffck_commons/models/res_partner.py

@ -1,7 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from dateutil.relativedelta import relativedelta
from odoo import models, fields, api from odoo import models, fields, api
from odoo.osv.expression import OR from odoo.osv.expression import OR
from .ffck_structure_type import SCALES
SCALES = [
("1", "National"),
("2", "Regional"),
("3", "Departmental"),
("4", "Local"),
("5", "Licensee"),
]
class ResPartner(models.Model): class ResPartner(models.Model):
@ -10,7 +18,13 @@ class ResPartner(models.Model):
# Partner fields # Partner fields
ffck_network = fields.Boolean(string="FFCK network") ffck_network = fields.Boolean(string="FFCK network")
first_membership_date = fields.Date("Structure 1st membership")
first_membership_date = fields.Date("1st membership")
last_membership_date = fields.Date("Last membership")
last_membership_validity = fields.Date(
string="Validity",
compute="_get_membership_validity",
store=True,
)
# Structure typing # Structure typing
partner_scale = fields.Selection( partner_scale = fields.Selection(
selection=SCALES, selection=SCALES,
@ -22,9 +36,22 @@ class ResPartner(models.Model):
comodel_name="ffck.structure.type", comodel_name="ffck.structure.type",
string="Structure type", string="Structure type",
) )
partner_code = fields.Char(string="FFCK code", size=6, index=True)
age_range = fields.Selection(
related="age_range_id.age_range",
store=True,
)
ffck_membership_type_id = fields.Many2one(
comodel_name="ffck.membership.type",
string="License type",
)
partner_code = fields.Char(
string="FFCK code",
size=6,
index=True,
)
partner_code_editable = fields.Boolean( partner_code_editable = fields.Boolean(
string="FFCK code editable", default=True, readonly=True
string="FFCK code editable",
default=True,
) )
# FFCK # FFCK
ffck_partner_id = fields.Many2one( ffck_partner_id = fields.Many2one(
@ -34,36 +61,44 @@ class ResPartner(models.Model):
compute="_get_ffck_partner", compute="_get_ffck_partner",
store=True, store=True,
) )
ffck_partner_code = fields.Char(string="FFCK", default="0", readonly=True)
ffck_partner_code = fields.Char(
string="FFCK",
default="0",
readonly=True,
)
# CRCK # CRCK
crck_partner_id = fields.Many2one( crck_partner_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
string="CRCK partner", string="CRCK partner",
index=True, index=True,
ondelete="restrict",
compute="_get_crck_partner", compute="_get_crck_partner",
store=True, store=True,
) )
crck_partner_code = fields.Char(related="crck_partner_id.partner_code", store=True)
crck_partner_code = fields.Char(
related="crck_partner_id.partner_code",
store=True,
)
# CDCK # CDCK
cdck_partner_id = fields.Many2one( cdck_partner_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
string="CDCK partner", string="CDCK partner",
index=True, index=True,
ondelete="restrict",
compute="_get_cdck_partner", compute="_get_cdck_partner",
store=True, store=True,
) )
cdck_partner_code = fields.Char(related="cdck_partner_id.partner_code", store=True)
cdck_partner_code = fields.Char(
related="cdck_partner_id.partner_code",
store=True,
)
local_partner_id = fields.Many2one( local_partner_id = fields.Many2one(
comodel_name="res.partner", comodel_name="res.partner",
string="Local partner", string="Local partner",
index=True, index=True,
ondelete="restrict",
domain=[("ffck_network", "=", True), ("partner_scale", "=", 4)], domain=[("ffck_network", "=", True), ("partner_scale", "=", 4)],
) )
local_partner_code = fields.Char( local_partner_code = fields.Char(
related="local_partner_id.partner_code", store=True
related="local_partner_id.partner_code",
store=True,
) )
crck_partner_ids = fields.One2many( crck_partner_ids = fields.One2many(
comodel_name="res.partner", comodel_name="res.partner",
@ -115,6 +150,29 @@ class ResPartner(models.Model):
# COMPUTES # COMPUTES
@api.depends("last_membership_date", "ffck_membership_type_id")
def _get_membership_validity(self):
to_process = self.filtered("ffck_membership_type_id").filtered(
"last_membership_date"
)
for partner in to_process:
date = partner.last_membership_date
year_end = date.replace(day=31, month=12)
membership = partner.ffck_membership_type_id
dur = membership.duration
unit = membership.unit
if unit == "day":
partner.last_membership_validity = date + relativedelta(days=dur - 1)
elif unit == "month":
partner.last_membership_validity = min(
date + relativedelta(days=-1, months=dur),
year_end,
)
elif unit == "year":
partner.last_membership_validity = year_end
for partner in self - to_process:
partner.last_membership_validity = False
@api.depends( @api.depends(
"is_company", "is_company",
"ffck_network", "ffck_network",
@ -157,7 +215,7 @@ class ResPartner(models.Model):
"cdck_partner_id", "cdck_partner_id",
) )
def _get_crck_partner(self): def _get_crck_partner(self):
cdck_ok = self.filtered("cdck_partner_id")
cdck_ok = self.filtered("cdck_partner_id.crck_partner_id")
for partner in cdck_ok: for partner in cdck_ok:
partner.crck_partner_id = partner.cdck_partner_id.crck_partner_id partner.crck_partner_id = partner.cdck_partner_id.crck_partner_id
todo = self - cdck_ok todo = self - cdck_ok
@ -174,7 +232,7 @@ class ResPartner(models.Model):
crck_by_state = {crck.state_id: crck for crck in crck_ok} crck_by_state = {crck.state_id: crck for crck in crck_ok}
concerned = todo.filtered( concerned = todo.filtered(
lambda rp: rp.ffck_network lambda rp: rp.ffck_network
and int(rp.partner_scale) >= 2
and int(rp.partner_scale) >= 3
and rp.state_id in states_ok and rp.state_id in states_ok
) )
for partner in concerned: for partner in concerned:
@ -196,7 +254,7 @@ class ResPartner(models.Model):
"country_department_id.code", "country_department_id.code",
) )
def _get_cdck_partner(self): def _get_cdck_partner(self):
local_ok = self.filtered("local_partner_id")
local_ok = self.filtered("local_partner_id.cdck_partner_id")
for partner in local_ok: for partner in local_ok:
partner.cdck_partner_id = partner.local_partner_id.cdck_partner_id partner.cdck_partner_id = partner.local_partner_id.cdck_partner_id
todo = self - local_ok todo = self - local_ok
@ -206,7 +264,7 @@ class ResPartner(models.Model):
and rp.ffck_network and rp.ffck_network
and rp.partner_code and rp.partner_code
and len(rp.partner_code) >= 2 and len(rp.partner_code) >= 2
and int(rp.partner_scale) in (3, 4)
and int(rp.partner_scale) == 4
) )
licensees = todo.filtered( licensees = todo.filtered(
lambda rp: not rp.is_company lambda rp: not rp.is_company
@ -335,7 +393,7 @@ class ResPartner(models.Model):
@api.onchange("partner_code", "company_type", "ffck_network") @api.onchange("partner_code", "company_type", "ffck_network")
def onchange_partner_code(self): def onchange_partner_code(self):
if self.ffck_network and self.is_company == False:
if self.ffck_network and not self.is_company:
code = self.partner_code or "000000" code = self.partner_code or "000000"
if len(code) < 6: if len(code) < 6:
self.update({"partner_code": code.zfill(6)}) self.update({"partner_code": code.zfill(6)})
@ -349,3 +407,11 @@ class ResPartner(models.Model):
# for vals in vals_list: # for vals in vals_list:
# vals.update({"partner_code_editable": False}) # vals.update({"partner_code_editable": False})
# return super().create(vals_list) # return super().create(vals_list)
def write(self, vals):
is_company = vals.get("is_company", None)
if is_company is True:
vals.update({"ffck_membership_type_id": False})
if is_company is False:
vals.update({"ffck_structure_type_id": False})
return super().write(vals)

15
ffck_commons/models/res_partner_age_range.py

@ -3,10 +3,25 @@
from odoo import _, api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from .ffck_membership_type import RANGES
class ResPartnerAgeRange(models.Model): class ResPartnerAgeRange(models.Model):
_inherit = "res.partner.age.range" _inherit = "res.partner.age.range"
name = fields.Char(translate=True) name = fields.Char(translate=True)
age_range = fields.Selection(
selection=RANGES,
string="Global range",
compute="_get_age_range",
store=True,
)
active = fields.Boolean(string="Active", default=True) active = fields.Boolean(string="Active", default=True)
@api.depends("age_to")
def _get_age_range(self):
for range in self:
if range.age_to <= 18:
range.age_range = "young"
else:
range.age_range = "adult"

4
ffck_commons/security/ir.model.access.csv

@ -1,4 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ffck_membership_type_all,All ffck.membership.type,ffck_commons.model_ffck_membership_type,,1,0,0,0
access_ffck_membership_type_group_partner_manager,Partner manager ffck.membership.type,ffck_commons.model_ffck_membership_type,base.group_system,1,1,1,0
access_ffck_structure_type_all,All ffck.structure.type,ffck_commons.model_ffck_structure_type,,1,0,0,0 access_ffck_structure_type_all,All ffck.structure.type,ffck_commons.model_ffck_structure_type,,1,0,0,0
access_ffck_structure_type_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_partner_manager,1,1,1,0
access_ffck_structure_type_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_system,1,1,1,0
access_res_partner_hierarchy_all,All res.partner.hierarchy,ffck_commons.model_res_partner_hierarchy,,1,0,0,0 access_res_partner_hierarchy_all,All res.partner.hierarchy,ffck_commons.model_res_partner_hierarchy,,1,0,0,0

106
ffck_commons/views/ffck_membership_type.xml

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="ffck_membership_type_view_form" model="ir.ui.view">
<field name="name">ffck.membership.type.view.form</field>
<field name="model">ffck.membership.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<field name="active" invisible="1" />
<field name="company_id" invisible="1" />
<field name="currency_id" invisible="1" />
<div class="oe_title">
<h1>
<field name="name" />
</h1>
</div>
<group col="6" colspan="6">
<group colspan="2">
<field name="short" />
<field name="age_range" />
</group>
<group colspan="2">
<label for="duration" />
<div class="o_row">
<field name="duration" />
<field name="unit" class="oe_inline" />
</div>
<field name="practice" />
</group>
<group colspan="2">
<field name="current_price" widget="monetary" />
<field name="competition" />
</group>
<group colspan="6">
<field name="structure_type_ids" widget="many2many_tags" options="{'no_create':1}" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="ffck_membership_type_view_tree" model="ir.ui.view">
<field name="name">ffck.membership.type.view.tree</field>
<field name="model">ffck.membership.type</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="short" />
<field name="duration" />
<field name="unit" />
<field name="age_range" />
<field name="practice" />
<field name="competition" />
<field name="current_price" widget="monetary" />
<field name="structure_type_ids" options="{'no_create':1}" />
</tree>
</field>
</record>
<record id="ffck_membership_type_view_search" model="ir.ui.view">
<field name="name">ffck.membership.type.view.search</field>
<field name="model">ffck.membership.type</field>
<field name="arch" type="xml">
<search>
<field name="name"
filter_domain="['|', ('name', 'ilike', self), ('short', 'ilike', self)]" />
<filter name="unit_year" string="Annual" domain="[('unit','=','year')]" />
<filter name="unit_month" string="Monthly" domain="[('unit','=','month')]" />
<filter name="unit_day" string="Daily" domain="[('unit','=','day')]" />
<separator />
<filter name="adult" string="Adult" domain="[('age_range','=','adult')]" />
<filter name="young" string="Young" domain="[('age_range','=','young')]" />
<separator />
<filter name="competition" string="Competition" domain="[('competition','=',True)]" />
<filter name="no_competition" string="Leisure" domain="[('competition','=',False)]" />
<filter name="no_practice" string="No practice" domain="[('practice','=',False)]" />
<group expand="0" name="group_by">
<filter name="by_unit" string="Time unit" context="{'group_by':'unit'}" />
<filter name="by_age_range" string="Age range" context="{'group_by':'age_range'}" />
<separator groups="base.group_multi_company" />
<filter name="by_company" string="Company" context="{'group_by':'company_id'}"
groups="base.group_multi_company" />
</group>
</search>
</field>
</record>
<record id="ffck_membership_type_action" model="ir.actions.act_window">
<field name="name">FFCK license types</field>
<field name="res_model">ffck.membership.type</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
<menuitem
id="ffck_membership_type_menu"
name="License types"
action="ffck_membership_type_action"
groups="base.group_system"
parent="ffck_contacts_config_menu"
sequence="5" />
</odoo>

52
ffck_commons/views/ffck_structure_type.xml

@ -7,13 +7,30 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<sheet> <sheet>
<field name="active" invisible="1" />
<field name="company_id" invisible="1" />
<field name="currency_id" invisible="1" />
<div class="oe_title"> <div class="oe_title">
<field name="name" />
<h1>
<field name="name" />
</h1>
</div> </div>
<group col="4">
<field name="short" />
<field name="scale" />
<field name="parent_id" colspan="4" options="{'no_create':1}" />
<group col="6">
<group colspan="2">
<field name="short" />
</group>
<group colspan="2">
<field name="scale" />
</group>
<group colspan="2">
<field name="current_price" widget="monetary" />
</group>
<group colspan="2">
<field name="parent_id" options="{'no_create':1}" />
</group>
<group colspan="4">
<field name="membership_type_ids" widget="many2many_tags" options="{'no_create':1}" />
</group>
</group> </group>
</sheet> </sheet>
</form> </form>
@ -25,14 +42,37 @@
<field name="model">ffck.structure.type</field> <field name="model">ffck.structure.type</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
<field name="active" invisible="1" />
<field name="company_id" invisible="1" />
<field name="currency_id" invisible="1" />
<field name="name" /> <field name="name" />
<field name="short" /> <field name="short" />
<field name="scale" /> <field name="scale" />
<field name="parent_id" colspan="4" options="{'no_create':1}" />
<field name="current_price" widget="monetary" />
<field name="parent_id" options="{'no_create':1}" />
<field name="membership_type_ids" options="{'no_create':1}" />
</tree> </tree>
</field> </field>
</record> </record>
<record id="ffck_structure_type_view_search" model="ir.ui.view">
<field name="name">ffck.structure.type.view.search</field>
<field name="model">ffck.structure.type</field>
<field name="arch" type="xml">
<search>
<field name="name"
filter_domain="['|', ('name', 'ilike', self), ('short', 'ilike', self)]" />
<group expand="0" name="group_by">
<filter name="by_scale" string="Scale" context="{'group_by':'scale'}" />
<filter name="by_parent" string="Parent" context="{'group_by':'parent_id'}" />
<separator groups="base.group_multi_company" />
<filter name="by_company" string="Company" context="{'group_by':'company_id'}"
groups="base.group_multi_company" />
</group>
</search>
</field>
</record>
<record id="ffck_structure_type_action" model="ir.actions.act_window"> <record id="ffck_structure_type_action" model="ir.actions.act_window">
<field name="name">FFCK structure types</field> <field name="name">FFCK structure types</field>
<field name="res_model">ffck.structure.type</field> <field name="res_model">ffck.structure.type</field>

86
ffck_commons/views/res_partner.xml

@ -28,14 +28,20 @@
<field name="partner_code_editable" invisible="1" /> <field name="partner_code_editable" invisible="1" />
<button type="object" name="lock_partner_code" string="Lock partner code" icon="fa-lock" <button type="object" name="lock_partner_code" string="Lock partner code" icon="fa-lock"
class="btn btn-warning oe_right" colspan="2" attrs="{'invisible':[('partner_code_editable','=',False)]}" /> class="btn btn-warning oe_right" colspan="2" attrs="{'invisible':[('partner_code_editable','=',False)]}" />
<field name="hierarchy_id" readonly="1" groups="base.group_no_one" />
<field name="age_range_id" position="move" />
<field name="partner_scale" attrs="{'invisible': [('is_company','=',False)]}" /> <field name="partner_scale" attrs="{'invisible': [('is_company','=',False)]}" />
<field name="ffck_structure_type_id" widget="selection"
<field name="ffck_structure_type_id" domain="[('scale','=',partner_scale)]"
attrs="{'invisible': [('is_company','=',False)]}" /> attrs="{'invisible': [('is_company','=',False)]}" />
<field name="age_range" invisible="1" />
<field name="ffck_membership_type_id" domain="[('age_range','=',age_range)]"
attrs="{'invisible': [('is_company','=',True)]}" />
<separator string="Structure dates" colspan="2" /> <separator string="Structure dates" colspan="2" />
<field name="first_membership_date" /> <field name="first_membership_date" />
<field name="last_membership_date" />
<field name="last_membership_validity" />
</group> </group>
<group name="ffck_network" colspan="2" string="Network" class="o_label_nowrap"> <group name="ffck_network" colspan="2" string="Network" class="o_label_nowrap">
<field name="hierarchy_id" readonly="1" groups="base.group_no_one" />
<field name="ffck_partner_id" attrs="{'invisible': [('partner_scale', 'in', ['1'])]}" /> <field name="ffck_partner_id" attrs="{'invisible': [('partner_scale', 'in', ['1'])]}" />
<label for="crck_partner_ids" attrs="{'invisible': [('partner_scale', '!=', '1')]}" colspan="2" /> <label for="crck_partner_ids" attrs="{'invisible': [('partner_scale', '!=', '1')]}" colspan="2" />
<field name="crck_partner_ids" attrs="{'invisible': [('partner_scale', '!=', '1')]}" mode="kanban" <field name="crck_partner_ids" attrs="{'invisible': [('partner_scale', '!=', '1')]}" mode="kanban"
@ -53,6 +59,9 @@
</group> </group>
</page> </page>
</xpath> </xpath>
<field name="age_range_id" position="attributes">
<attribute name="attrs">{'invisible': [('is_company','=',True)]}</attribute>
</field>
</field> </field>
</record> </record>
@ -62,11 +71,9 @@
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information" /> <field name="inherit_id" ref="partner_contact_personal_information_page.personal_information" />
<field name="priority">30</field> <field name="priority">30</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="birthplace" position="after">
<field name="gender" widget="radio" options="{'horizontal': true}" />
</field>
<field name="age" position="after"> <field name="age" position="after">
<field name="age_range_id" widget="selection" /> <field name="age_range_id" widget="selection" />
<field name="gender" widget="radio" options="{'horizontal': true}" />
</field> </field>
</field> </field>
</record> </record>
@ -95,7 +102,6 @@
<filter name="partner_scale" string="Partner scale" domain="[]" context="{'group_by' : 'partner_scale'}" /> <filter name="partner_scale" string="Partner scale" domain="[]" context="{'group_by' : 'partner_scale'}" />
<filter name="ffck_structure_type" string="Structure type" <filter name="ffck_structure_type" string="Structure type"
context="{'group_by' : 'ffck_structure_type_id'}" /> context="{'group_by' : 'ffck_structure_type_id'}" />
<filter name="by_age_range" string="Age range" context="{'group_by': 'age_range_id'}" />
</group> </group>
<search position="inside"> <search position="inside">
<searchpanel> <searchpanel>
@ -105,6 +111,26 @@
</field> </field>
</record> </record>
<record id="res_partner_view_search_inherit_persons" model="ir.ui.view">
<field name="name">res.partner.view.search.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_persons.res_partner_view_search" />
<field name="priority">30</field>
<field name="arch" type="xml">
<filter name="ffck_network" position="after">
<separator />
<filter name="adult" string="Adults" domain="[('age_range','=','adult')]" />
<filter name="young" string="Youngs" domain="[('age_range','=','young')]" />
</filter>
<filter name="ffck_structure_type" position="after">
<separator />
<filter name="by_age_range" string="Age range" context="{'group_by': 'age_range_id'}" />
<filter name="ffck_membership_type" string="License type"
context="{'group_by' : 'ffck_membership_type_id'}" />
</filter>
</field>
</record>
<!-- ACTIONS --> <!-- ACTIONS -->
<record id="contacts.action_contacts" model="ir.actions.act_window"> <record id="contacts.action_contacts" model="ir.actions.act_window">
@ -115,42 +141,11 @@
'search_default_state_groupby': 1}</field> 'search_default_state_groupby': 1}</field>
</record> </record>
<record id="action_persons" model="ir.actions.act_window">
<field name="name">Persons</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_mode">tree,kanban,form,activity</field>
<field name="search_view_id" ref="base.view_res_partner_filter" />
<record id="partner_contact_persons.action_persons" model="ir.actions.act_window">
<field name="context">{'default_is_company': False, <field name="context">{'default_is_company': False,
'search_default_type_person':1, 'search_default_type_person':1,
'search_default_ffck_network':1, 'search_default_ffck_network':1,
'search_default_by_age_range': 1}</field> 'search_default_by_age_range': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a Contact in your address book
</p>
<p>
Odoo helps you track all activities related to your contacts.
</p>
</field>
</record>
<record id="action_persons_view_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="0" />
<field name="view_mode">kanban</field>
<field name="view_id" ref="base.res_partner_kanban_view" />
<field name="act_window_id" ref="action_persons" />
</record>
<record id="action_persons_view_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="1" />
<field name="view_mode">tree</field>
<field name="view_id" ref="base.view_partner_tree" />
<field name="act_window_id" ref="action_persons" />
</record>
<record id="action_persons_view_form" model="ir.actions.act_window.view">
<field name="sequence" eval="2" />
<field name="view_mode">form</field>
<field name="view_id" ref="base.view_partner_form" />
<field name="act_window_id" ref="action_persons" />
</record> </record>
<!-- MENUS --> <!-- MENUS -->
@ -159,14 +154,8 @@
<field name="name">Structures</field> <field name="name">Structures</field>
</record> </record>
<menuitem
id="res_partner_menu_persons"
name="Persons"
action="action_persons"
parent="contacts.menu_contacts"
sequence="3" />
<record id="contacts.res_partner_menu_config" model="ir.ui.menu">
<record id="partner_multi_relation.menu_res_partner_relation" model="ir.ui.menu">
<field name="parent_id" ref="contacts.res_partner_menu_config" />
<field name="sequence">4</field> <field name="sequence">4</field>
</record> </record>
@ -176,9 +165,4 @@
parent="contacts.res_partner_menu_config" parent="contacts.res_partner_menu_config"
sequence="4" /> sequence="4" />
<record id="partner_multi_relation.menu_res_partner_relation" model="ir.ui.menu">
<field name="parent_id" ref="contacts.res_partner_menu_config" />
<field name="sequence">4</field>
</record>
</odoo> </odoo>
Loading…
Cancel
Save