Initial commit

This commit is contained in:
gsinghpal
2026-02-22 01:22:18 -05:00
commit 5200d5baf0
2394 changed files with 386834 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# Fusion Accounting - Menu Visibility Rules
# Restricts certain accounting menus to users with the account readonly group
from odoo import models
class FusionIrUiMenu(models.Model):
"""Controls visibility of advanced accounting menus so they are
only shown to users who have at least the account-readonly role."""
_inherit = 'ir.ui.menu'
def _visible_menu_ids(self, debug=False):
"""Filter out specialised accounting menus for users lacking
the ``account.group_account_readonly`` permission."""
visible = super()._visible_menu_ids(debug)
if not self.env.user.has_group('account.group_account_readonly'):
restricted_refs = [
'fusion_accounting.account_tag_menu',
'fusion_accounting.menu_account_group',
'fusion_accounting.menu_action_account_report_multicurrency_revaluation',
]
hidden_ids = set()
for xml_ref in restricted_refs:
menu = self.env.ref(xml_ref, raise_if_not_found=False)
if menu:
hidden_ids.add(menu.sudo().id)
return visible - hidden_ids
return visible