Search code examples
inheritancemenuitemodoo-12

Odoo 12 : Change the name of the menuitem of an inherited view


I want to change the name of a menuitem( All timesheets to All activities) by view inheritance but it doesn't work.

This is original menu

<menuitem id="timesheet_menu_activity_all"
           name="All Timesheets"
           parent="menu_hr_time_tracking"
           action="timesheet_action_all"/>

another one is a new menu

 <menuitem id="hr_timesheet.timesheet_menu_activity_all"
            name="All Activities"
            parent="hr_timesheet.menu_hr_time_tracking"
            action="hr_timesheet.timesheet_action_all"/>

Solution

  • Please use this code to change the name of existing menu Item name.

    <record model="ir.ui.menu" id="hr_timesheet.timesheet_menu_activity_all">
        <field name='name'>All Activities</field>
    </record>
    

    The menu entries are stored as records of the 'ir.ui.menu' object type, so it is possible to use 'record' XML tags to update 'ir.ui.menu' records by providing 'model' and 'id' attributes to identify the existing record.

    Thanks