Browse Source

[IMP] ffck_commons

16.0
RemiFr82 7 months ago
parent
commit
c0e00106e4
  1. 98
      ffck_commons/i18n/fr.po
  2. 2
      ffck_commons/models/ffck_structure_type.py
  3. 17
      ffck_commons/models/res_partner.py

98
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-26 13:55+0000\n"
"PO-Revision-Date: 2024-05-26 13:55+0000\n"
"POT-Creation-Date: 2024-05-26 23:35+0000\n"
"PO-Revision-Date: 2024-05-26 23:35+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -20,6 +20,11 @@ msgstr ""
msgid "Active" msgid "Active"
msgstr "Actif" msgstr "Actif"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_club
msgid "Affiliate member"
msgstr "Membre affilié"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__cdck_partner_id #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__cdck_partner_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__cdck_partner_id #: model:ir.model.fields,field_description:ffck_commons.field_res_users__cdck_partner_id
@ -37,6 +42,11 @@ msgstr "CRCK"
msgid "Contact" msgid "Contact"
msgstr "" msgstr ""
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_conv
msgid "Conventioned member"
msgstr "Membre conventionné"
#. module: ffck_commons #. module: ffck_commons
#: 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"
@ -48,11 +58,16 @@ msgid "Created on"
msgstr "Créé le" msgstr "Créé le"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__dep
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__dep
#: 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
msgid "Departmental" msgid "Departmental"
msgstr "Départementale" msgstr "Départementale"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_cdck
msgid "Departmental Committee"
msgstr "Comité Départemental"
#. module: ffck_commons #. module: ffck_commons
#: 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
msgid "Display Name" msgid "Display Name"
@ -68,9 +83,11 @@ msgstr ""
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__cdck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__cdck_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__crck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__crck_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__local_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__cdck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_users__cdck_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__crck_partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_users__crck_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__local_partner_code
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__partner_code #: model:ir.model.fields,field_description:ffck_commons.field_res_users__partner_code
msgid "FFCK code" msgid "FFCK code"
msgstr "Code FFCK" msgstr "Code FFCK"
@ -81,6 +98,11 @@ msgstr "Code FFCK"
msgid "FFCK network" msgid "FFCK network"
msgstr "Réseau FFCK" msgstr "Réseau FFCK"
#. module: ffck_commons
#: model:ir.ui.menu,name:ffck_commons.ffck_contacts_config_menu
msgid "FFCK params"
msgstr "Config FFCK"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_partner_id #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_partner_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_partner_id #: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_partner_id
@ -92,6 +114,16 @@ msgstr "FFCK"
msgid "FFCK structure type" msgid "FFCK structure type"
msgstr "Type de structure" msgstr "Type de structure"
#. module: ffck_commons
#: model:ir.actions.act_window,name:ffck_commons.ffck_structure_type_action
msgid "FFCK structure types"
msgstr "Types de structures"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_ffck
msgid "Federation"
msgstr "Fédération"
#. module: ffck_commons #. module: ffck_commons
#: 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
msgid "ID" msgid "ID"
@ -118,8 +150,8 @@ msgid "License code"
msgstr "N° de licence" msgstr "N° de licence"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__lic
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__lic
#: 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
msgid "Licensee" msgid "Licensee"
msgstr "Licencié" msgstr "Licencié"
@ -129,16 +161,16 @@ msgid "Licensee information"
msgstr "Informations licencié" msgstr "Informations licencié"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__loc
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__loc
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__4
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__4
msgid "Local" msgid "Local"
msgstr "Locale" msgstr "Locale"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__license_partner_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__license_partner_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__local_partner_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__local_partner_id
msgid "Local partner" msgid "Local partner"
msgstr "Structure Locale"
msgstr "Structure locale"
#. module: ffck_commons #. module: ffck_commons
#: 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
@ -146,8 +178,8 @@ msgid "Name"
msgstr "Nom" msgstr "Nom"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__nat
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__nat
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__1
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__1
msgid "National" msgid "National"
msgstr "Nationale" msgstr "Nationale"
@ -162,11 +194,26 @@ msgid "Parent"
msgstr "" msgstr ""
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields.selection,name:ffck_commons.selection__ffck_structure_type__scale__reg
#: model:ir.model.fields.selection,name:ffck_commons.selection__res_partner__partner_scale__reg
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Partner scale"
msgstr "Échelle"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Persons"
msgstr "Personnes"
#. 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__res_partner__partner_scale__2
msgid "Regional" msgid "Regional"
msgstr "Régionale" msgstr "Régionale"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_crck
msgid "Regional Committee"
msgstr "Comité Régional"
#. module: ffck_commons #. module: ffck_commons
#: 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
@ -203,5 +250,26 @@ msgstr "Infos de la structure"
#. module: ffck_commons #. module: ffck_commons
#: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_structure_type_id #: model:ir.model.fields,field_description:ffck_commons.field_res_partner__ffck_structure_type_id
#: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_structure_type_id #: model:ir.model.fields,field_description:ffck_commons.field_res_users__ffck_structure_type_id
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Structure type" msgid "Structure type"
msgstr "Type de structure" msgstr "Type de structure"
#. module: ffck_commons
#: model:ir.ui.menu,name:ffck_commons.ffck_structure_type_menu
msgid "Structure types"
msgstr "Types de structure"
#. module: ffck_commons
#: model_terms:ir.ui.view,arch_db:ffck_commons.view_res_partner_filter_inherit_base
msgid "Structures"
msgstr "Structures"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_agra
msgid "Type A agreed member"
msgstr "Membre agréé Type A"
#. module: ffck_commons
#: model:ffck.structure.type,name:ffck_commons.ffck_structure_type_agrb
msgid "Type B agreed member"
msgstr "Membre agréé Type B"

2
ffck_commons/models/ffck_structure_type.py

@ -17,6 +17,6 @@ class FfckStructureType(models.Model):
name = fields.Char("Name", required=True, translate=True) name = fields.Char("Name", required=True, translate=True)
short = fields.Char("Short", required=True, index=True) short = fields.Char("Short", required=True, index=True)
scale = fields.Selection(SCALES, string="Scale", required=True)
scale = fields.Selection(selection=SCALES, string="Scale", required=True)
active = fields.Boolean(string="Active", default=True) active = fields.Boolean(string="Active", default=True)
parent_id = fields.Many2one(comodel_name="ffck.structure.type", string="Parent") parent_id = fields.Many2one(comodel_name="ffck.structure.type", string="Parent")

17
ffck_commons/models/res_partner.py

@ -18,7 +18,8 @@ class ResPartner(models.Model):
store=True, store=True,
) )
ffck_structure_type_id = fields.Many2one( ffck_structure_type_id = fields.Many2one(
comodel_name="ffck.structure.type", string="Structure type"
comodel_name="ffck.structure.type",
string="Structure type",
) )
partner_code = fields.Char(string="FFCK code", size=6, index=True) partner_code = fields.Char(string="FFCK code", size=6, index=True)
# partner_code_editable = fields.Boolean(string="FFCK code editable", compute="_can_edit_partner_code") # partner_code_editable = fields.Boolean(string="FFCK code editable", compute="_can_edit_partner_code")
@ -110,10 +111,7 @@ class ResPartner(models.Model):
if partner.company_type == "individual": if partner.company_type == "individual":
partner.partner_scale = "5" partner.partner_scale = "5"
else: else:
partner.partner_scale = (
partner.ffck_structure_type_id
and partner.ffck_structure_type_id.scale
)
partner.partner_scale = partner.ffck_structure_type_id.scale
def _get_ffck_partner(self): def _get_ffck_partner(self):
ffck = self.env.ref("ffck_commons.res_partner_ffck", raise_if_not_found=False) ffck = self.env.ref("ffck_commons.res_partner_ffck", raise_if_not_found=False)
@ -136,8 +134,9 @@ class ResPartner(models.Model):
("state_id", "in", states.ids), ("state_id", "in", states.ids),
] ]
) )
crck_by_state = {(crck.state_id, crck) for crck in crck_ok}
states_ok = states - crck_ok.mapped("state_id")
crck_by_state = {crck.state_id: crck for crck in crck_ok}
print(crck_by_state)
states_ok = states & crck_ok.mapped("state_id")
concerned = self.filtered( concerned = self.filtered(
lambda rp: rp.ffck_network lambda rp: rp.ffck_network
and int(rp.partner_scale) >= 3 and int(rp.partner_scale) >= 3
@ -160,8 +159,8 @@ class ResPartner(models.Model):
("country_department_id", "in", depts.ids), ("country_department_id", "in", depts.ids),
] ]
) )
cdck_by_dept = {(cdck.country_department_id, cdck) for cdck in cdck_ok}
depts_ok = depts - cdck_ok.mapped("country_department_id")
cdck_by_dept = {cdck.country_department_id: cdck for cdck in cdck_ok}
depts_ok = depts & cdck_ok.mapped("country_department_id")
concerned = self.filtered( concerned = self.filtered(
lambda rp: rp.ffck_network lambda rp: rp.ffck_network
and int(rp.partner_scale) >= 4 and int(rp.partner_scale) >= 4

Loading…
Cancel
Save