为什么我们必须创建一个新组来对 Odoo v8 中的所有用户隐藏菜单项?

Why do we have to create a new group to hide a menuitem from all users in Odoo v8?

我只是想知道为什么我们必须应用此解决方案来对所有用户(包括技术功能的管理员)隐藏现有菜单项:

Remove or hide a menu item in Odoo

我的意思是,谁能解释一下为什么这不起作用?

<record id="stock_account.menu_action_history_tree" model="ir.ui.menu">
    <field name="groups_id" eval="[(6, 0, [])]"/>
</record>

在此之后,如果我进入界面并在技术功能部分查看此菜单项记录,我可以看到 groups_id many2many 列表是空的。那么,为什么管理员还能看到呢?

我认为您必须将操作设置为 false 才能隐藏菜单项, 这有助于

<record id="stock_account.menu_action_history_tree" model="ir.ui.menu">
    <field name="action" eval="False"/>
</record>

如果 groups_id 字段为空,Odoo 将根据相关对象的读取权限计算可见性。

您可以在 addons/base/ir/ir_ui_view.py 找到此帮助。

'groups_id': fields.many2many('res.groups', 'ir_ui_menu_group_rel', 'menu_id', 'gid', 'Groups', help="If you have groups, the visibility of this menu will be based on these groups. "\ "If this field is empty, Odoo will compute visibility based on the related object's read access."),