mirror of
https://gitlab.com/flectra-community/server-ux.git
synced 2024-11-22 22:22:05 +00:00
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
|
# Copyright 2020 Tecnativa - Víctor Martínez
|
||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||
|
|
||
|
from flectra.tests.common import TransactionCase
|
||
|
|
||
|
|
||
|
class TestIrUiMenuCase(TransactionCase):
|
||
|
def setUp(self):
|
||
|
super().setUp()
|
||
|
self.user_admin = self.browse_ref("base.user_admin").id
|
||
|
self.group_hide_menu = self.env["res.groups"].create(
|
||
|
{"name": "Hide menu items custom", "users": [(4, self.user_admin)]}
|
||
|
)
|
||
|
self.model_ir_uir_menu = self.env["ir.ui.menu"]
|
||
|
self.ir_ui_menu = self.browse_ref("base.menu_management")
|
||
|
|
||
|
def test_ir_ui_menu_admin(self):
|
||
|
items = self.model_ir_uir_menu.with_user(self.user_admin)._visible_menu_ids()
|
||
|
self.assertTrue(self.ir_ui_menu.id in items)
|
||
|
# Update ir_ui_menu to assign excluded_group_ids
|
||
|
self.ir_ui_menu.write({"excluded_group_ids": [(4, self.group_hide_menu.id)]})
|
||
|
items = self.model_ir_uir_menu.with_user(self.user_admin)._visible_menu_ids()
|
||
|
self.assertTrue(self.ir_ui_menu.id not in items)
|