Skip to content

Commit

Permalink
[FIX] portal_backend: add hook to set menu's group if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno-Zanotti committed Sep 4, 2023
1 parent f568827 commit f5ffa4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions portal_backend/__init__.py
Expand Up @@ -2,5 +2,17 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################

from odoo import api, SUPERUSER_ID, Command

from . import models
from . import controllers

def post_init(cr, registry):
""" Add internal users group to menu items
"""
env = api.Environment(cr, SUPERUSER_ID, {})

env['ir.ui.menu'].search([("groups_id", "=", False), ("parent_id", "=", False)]).write({
'groups_ids': [Command.link(env.ref('base.group_user').id)]
})
3 changes: 2 additions & 1 deletion portal_backend/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Portal Backend',
'version': "16.0.1.0.0",
'version': "16.0.1.1.0",
'category': 'Base',
'sequence': 14,
'summary': '',
Expand All @@ -38,6 +38,7 @@
'demo': [
'demo/res_users_demo.xml',
],
'post_init_hook': 'post_init',
'installable': True,
'auto_install': False,
'application': False,
Expand Down

0 comments on commit f5ffa4a

Please sign in to comment.