How to Hide a Menu/Submenu from All Users in Odoo?
Once we install a specific module in Odoo, there is situation where we decide to hide some menu/submenus (unwanted menus for our customized module).
Possible ways to hide menus are:
1.Hide from user interface
- i) Go to settings -> Groups -> create a group with no user inside it.
- ii) Go to settings -> technical -> user interface -> menu and search Reporting top Assign the menu item to that no user group.
NOTE: This way we can hide menu but the changes would be for current database only.If we create new database and install the module the menu will reappear.
2.Through xml file
- i) Create a group with no users in it.
- ii) Assign the menu item to that group.
NOTE: This can be a permanent solution, as we have made changes in xml file, the changes will reflect on creation on new database.
I have installed HR module and I want to hide Reporting Top menu.
1.<record id=”group_hide_menus” model=”res.groups”>
<field name=”name”>Restricted Menus Group</field>
<field name=”comment”>Restricted Menus Group</field>
Created record in res_groups with no users in it
2.<record model=”ir.ui.menu” id=”base.menu_reporting”>
<field name=”groups_id” eval=”[(6, 0, [ref(‘group_hide_menus’)])]”/>
Assigned Reporting top menu to that group which is Restricted Menus Group
Here record id is nothing but the Reporting Top menu id .
There are six numeric commands:
0 – creates a new object and adds it to the Many2many relation
1 – updates an object that already exists on the relation
2 – deletes an object that already exists on the relation
3 – removes an existing object from the relation, without deleting it
4 – adds an existing object to the relation
5 – removes all objects from the relation, without deleting them
6 – replaces previous objects existing on the relation with a new set of objects
As here I have used eval=”[(6, 0, [ref(‘group_hide_menus’)])]” .The eval statement here means, replace all existing ids in the groups_id field with the id for group Restricted Menus
For any further queries feel free to Contact Us we would be glad to help you.