How to Override Menu Items in Odoo 9?

How to Override Menu Items in Odoo 9?
  1. Changes Name of menu by inheriting.

 

<record id=”crm.crm_case_category_act_oppor11″ model=”ir.actions.act_window”>

<field name=”context”>{‘stage_type’: ‘opportunity’, ‘default_type’: ‘opportunity’, ‘default_user_id’: uid, ‘needaction_menu_ref’: ‘sale.menu_sale_quotations’}</field>

<field name=”name”>Opportunities – PT action</field>

</record>

 

<record model=”ir.ui.menu” id=”hr.menu_hr_root”>

<field name=”name”>HR</field>

</record>

 

  1. Override groups

<menuitem name=”menuName” id=”mod_id.menu_id” … />

At installing the module, however, they are stored as records of the ‘ir.ui.menu’ object type. where the many2many relationship to ‘res.groups’ is defined.

 

Given that, it is perfectly possible to use ‘record’ XML tags to update ‘ir.ui.menu’ records by providing ‘model’ and ‘id’ attributes to identify the existing record. E.g. Project>Configuration (source here):

<record model=”ir.ui.menu” id=”mod_id.menu_id”>

<field name=”groups_id” eval=”[(6,0,[ref(‘group_my_restricted_group’)])]”/>

</record>

Just remember ‘groups_id’ is a many2many relationship, so you will require to provide an appropriate tuple to update the relationship (the above example replaces all groups). Look for the documentation of ‘write(vals)’ here for a reference.

 

<!–giving groups to sales (4:add extra, 6:override all)–>

<record model=’ir.ui.menu’ id=’base.menu_base_partner’>

<field name=”groups_id” eval=”[(4,ref(‘pettools.group_sales_designer’))]”/><!–(4,ref(‘base.group_sale_manager’)),(4,ref(‘base.group_sale_salesman’)),–>

</record>

 

3.Override parent menuitems

 

<record model=”ir.ui.menu” id=”project_issue.portal_services_issues”>

<field name=”name”>Issue Tracker</field>

<field name=”parent_id” ref=”visas_avenue.menu_helpdesk”/>

<!–<field name=”sequence”>30</field>–>

</record>

For further query on ERP software feel free to Contact Us