forvas
forvas

Reputation: 10189

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

I was just wondering why we have to apply this solution to hide an existing menuitem from all users (administrator with technical features included):

Remove or hide a menu item in Odoo

I mean, can anyone explain me why this does not work?

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

After this, if I go to the interface and check this menuitem record in the technical features section, I can see that the groups_id many2many list is empty. So, why is the administrator still able to see it?

Upvotes: 2

Views: 128

Answers (2)

Kenly
Kenly

Reputation: 26738

If groups_id field is empty, Odoo will compute visibility based on the related object's read access.

You can find this help at 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."),

Upvotes: 2

khelili miliana
khelili miliana

Reputation: 3822

I think you have to make action false to hide the menutitem, This helps

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

Upvotes: 2

Related Questions