初始提交

This commit is contained in:
2026-11-04 19:58:07 +08:00
commit 53b7d22429
829 changed files with 469986 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class IrUiMenu(models.Model):
_inherit = 'ir.ui.menu'
def _get_account_readonly_menu_ids(self):
"""
Returns a list of xmlids to hide if the user does not have the `group_account_readonly` group.
"""
return [
'account_accountant.account_tag_menu',
]
def _visible_menu_ids(self, debug=False):
visible_ids = super()._visible_menu_ids(debug)
# These menus should only be visible to accountants (users with group_account_readonly) and the group specified on the menu
# We want to avoid moving these menus to the new `accountant` module
if not self.env.user.has_group('account.group_account_readonly'):
accounting_menus = self._get_account_readonly_menu_ids()
hidden_menu_ids = {
menu_id for ref_menu in accounting_menus
if (menu_id := self.env['ir.model.data']._xmlid_to_res_id(ref_menu))
}
return visible_ids - hidden_menu_ids
return visible_ids