This question has been flagged
2 Replies
2547 Views

Hi,

I would like to hide a menu to a specific group even if this group has access to the model called by that menu. 

(access is currently set to all permissions: 1, 1, 1, 1)

So far I have tried this solution but it does not work:

<record id="module.target_menu" model="ir.ui.menu">
<field name="groups_id" eval="[(3,ref('model.my_target_group'))]"/>
</record>


Any idea? Is it possible anyway?

Avatar
Discard
Best Answer

you can hide a menu from a specific group in Odoo:

  1. Identify the ID of the menu you want to hide. You can find the menu ID by inspecting the HTML source code of the menu in Odoo's backend or by looking at the module that defines the menu.

  2. Create a new module or locate an existing module where you can define the menu modification.

  3. In your module, create a new XML file (e.g., data.xml) and add the following code

odoo>
data>
record id="your_module.target_menu" model="" rel="ugc">ir.ui.menu">
field name="groups_id" eval="[(5, 0, 0), (4, ref('model.my_target_group'))]"/>
/record>
/data>
/odoo>

In this code, replace your_module.target_menu with the appropriate ID of the menu you want to hide.

  1. In the groups_id field, use the following evaluation codes:

    • (5, 0, 0) to remove all existing groups from the menu's access rights.
    • (4, ref('model.my_target_group')) to add the reference to the specific group you want to hide the menu from. Replace model.my_target_group with the appropriate ID or XML ID of your target group.
  2. Install or upgrade your module containing the XML file.

After completing these steps, the menu should be hidden from the specified group, even if the group has access to the underlying model. The menu will only be visible to users who belong to groups explicitly specified in the groups_id field of the menu record.

Avatar
Discard
Best Answer

Hi,
Please refer the below app

 https://apps.odoo.com/apps/modules/16.0/hide_menu_user/

Hope it helps

Avatar
Discard