Skip to content
Extraits de code Groupes Projets
Valider 3e387c0b rédigé par jordan's avatar jordan
Parcourir les fichiers

[add] add multi_compnay_menu

parent 16cdc618
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
"installable": True, "installable": True,
"depends": [ "depends": [
"account", "account",
"account_banking_sepa_direct_debit",
"cgscop_liste_ministere", "cgscop_liste_ministere",
"cgscop_partner", "cgscop_partner",
"account_banking_sepa_direct_debit", "multi_company_menu",
], ],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
......
...@@ -17,3 +17,36 @@ class CotisationsConfigSettings(models.TransientModel): ...@@ -17,3 +17,36 @@ class CotisationsConfigSettings(models.TransientModel):
readonly=False, readonly=False,
string='Journal des cotisations', string='Journal des cotisations',
domain="[('type', '=', 'sale')]") domain="[('type', '=', 'sale')]")
def add_company_to_menu(self, menu, bool_condition):
"""
Add current company to the list of companies allowed to see menu
:param menu: target menu
:param bool_condition: condition to check to allow company or not
:return: add company to menu
"""
current_company_id = self.env.user.company_id
if bool_condition:
if current_company_id not in menu.company_ids:
menu.write({
"company_ids": [(4, current_company_id.id)]
})
else:
if current_company_id in menu.company_ids:
menu.write({
"company_ids": [(3, current_company_id.id)]
})
def execute(self):
"""
Rewrite execute() function to add current company to the list
of available company in ir_ui_menu
"""
res = super(CotisationsConfigSettings, self).execute()
menu_cotiz = self.env.ref(
'cgscop_cotisation.menu_scop_cotisation')
bool_condition = self.is_contribution
self.add_company_to_menu(menu_cotiz, bool_condition)
return res
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter