Search code examples
xmlodooodoo-15

How to hide a menuitem for a specific group in Odoo 15?


A lot of people asks this question but they mark as correct the answer which hides the menuitem from the users who do not belong to a specific group, and that is not what the question asks.

I want to do it the other way around, example:

-Generate a group named for example Hide contacts:

<record id="group_hide_contacts" model="res.groups">
    <field name="name">Hide Contacts</field>
    <field name="category_id" ref="base.module_category_hidden" />
</record>

-If you add an user to this group, the user will not able to see the menuitem Contacts (contacts.menu_contacts). But they still will preserve the right of the other groups they belong to.

Any ideas? Is any trick to manage this? Because the Odoo groups are made to add permissions, not to remove them...


Solution

  • You can use the base_menu_visibility_restriction OCA module

    This addon lets you assign "excluded groups" to menu items. If a user belongs to a group that is assigned to a menu item as an excluded group, the user will not be able to see the menu item