Search code examples
pythonodoo

How to hide the inherited menu item in odoo menu?


In my project I have created a module that inherits models and views from HR module (employees), so I have define in the manifest that my module should deoends on the hr module. When I install my module it also installs the hr module and shows the "employees" menu item in odoo main menu. I have no use for the employees views, so how can I hide the "employees" menu item?

enter image description here


Solution

  • You can specify the groups allowed to use/access the current menu entry using the Access Rights tab of the menu item form view.

    Go to Settings/Technical/User Interface/Menu Items and search for Employees, in the Access Rights tab select the ERP manager group or a group with no user to restrict access to everyone.

    Menus are regular records in database, usually declared through data files. You can use a data file to update Employees menu record using its external id.

    <record model="ir.ui.menu" id="hr.menu_hr_root">
        <field name="groups_id" eval="[(6, 0, [ref('base.group_erp_manager')])]"/>
    </record>
    

    The special command [(6, 0, ids)] replaces all existing records in the set by the ids list