Skip to content

Commit 9c2d435

Browse files
[19.0][MIG] base_menu_visibility_restriction
Following the changes in standard code, the `excluded_group_ids` was moved outside the Notebook in the Form view and displayed as `many2many_tags` widget.
1 parent cbf49aa commit 9c2d435

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

base_menu_visibility_restriction/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "Base Menu Visibility Restriction",
6-
"version": "18.0.1.0.0",
6+
"version": "19.0.1.0.0",
77
"category": "Extra Tools",
88
"development_status": "Production/Stable",
99
"author": "Tecnativa, Odoo Community Association (OCA)",

base_menu_visibility_restriction/models/ir_ui_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class IrUiMenu(models.Model):
1515
)
1616

1717
@api.model
18-
@tools.ormcache("frozenset(self.env.user.groups_id.ids)", "debug")
18+
@tools.ormcache("frozenset(self.env.user.group_ids.ids)", "debug")
1919
def _visible_menu_ids(self, debug=False):
2020
"""Return the ids of the menu items visible to the user."""
2121
visible = super()._visible_menu_ids(debug=debug)
2222
context = {"ir.ui.menu.full_list": True}
2323
menus = self.with_context(**context).browse(visible)
24-
groups = self.env.user.groups_id
24+
groups = self.env.user.group_ids
2525
visible = menus - menus.filtered(lambda menu: menu.excluded_group_ids & groups)
2626
return set(visible.ids)

base_menu_visibility_restriction/readme/CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
- Víctor Martínez
33
- Dhara Solanki \<<dhara.solanki@initos.com>\>
44
- Nedas Žilinskas \<<nedas.zilinskas@avoin.systems>\>
5+
- Maciej Wichowski \<<maciej@versada.eu>\>

base_menu_visibility_restriction/tests/test_ir_ui_menu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setUp(self):
99
super().setUp()
1010
self.user_admin = self.browse_ref("base.user_admin").id
1111
self.group_hide_menu = self.env["res.groups"].create(
12-
{"name": "Hide menu items custom", "users": [(4, self.user_admin)]}
12+
{"name": "Hide menu items custom", "user_ids": [(4, self.user_admin)]}
1313
)
1414
self.model_ir_uir_menu = self.env["ir.ui.menu"]
1515
self.ir_ui_menu = self.browse_ref("base.menu_management")

base_menu_visibility_restriction/views/ir_ui_menu.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
<field name="model">ir.ui.menu</field>
99
<field name="inherit_id" ref="base.edit_menu_access" />
1010
<field name="arch" type="xml">
11-
<field name="groups_id" position="before">
12-
<label for="groups_id" />
13-
</field>
14-
<field name="groups_id" position="after">
15-
<label for="excluded_group_ids" />
16-
<field name="excluded_group_ids" />
11+
<field name="group_ids" position="after">
12+
<field name="excluded_group_ids" widget="many2many_tags" />
1713
</field>
1814
</field>
1915
</record>

0 commit comments

Comments
 (0)