Odoo Help


How to change the name of an existing menuitem?

Juan Formoso
on 11/10/14, 10:59 AM 8,241 views

I'd like to change the label of a couple menu options. For example, I want to change the name of the main menu option Sales (crm). I know how to achieve this from the user interface, but it's better to do it through code.

I read in other posts that the only way to do this is declaring a new menuitem with the same ID of the menuitem you want to change. So, I want to change these ones (main menu option and submenu):

<menuitem name="Sales"
<menuitem id="base.menu_sales" parent="base.menu_base_partner" name="Sales" sequence="1" />

So I put this in my module code:

<menuitem name="My new string"
<menuitem id="base.menu_sales" parent="base.menu_base_partner" name="My new string" sequence="1" />

What is happening is that the top menu option "Sales" is turned into "My new string", which is correct. However, the submenu is not being changed and even more, the other submenus (which were in blue color) are being transformed in dropdown options.

If I remove the line <menuitem id="base.menu_sales" parent="base.menu_base_partner" name="My new string" sequence="1" />, the top menu option "Sales" is not being altered, and if I leave that line and add another menuitem whose parent is base.menu_sales, then both menu and submenu options are replaced well but the other submenus are being transformed in dropdown options.

Can anyone help me, please?


I tried next code too, but nothing changed. I'm sure that the XML ID I'm using is right (I'm getting it from Configuration > User interface > Menu items)

<record model="ir.ui.menu" id="base.menu_base_partner">
     <field name="name">My New Menu Name</field>

Jesús Ventosinos
on 11/10/14, 1:23 PM

sorry for multiple answers, you need to change id="menu_base_partner" to id="base.menu_base_partner"

Jesús Ventosinos
on 11/10/14, 1:24 PM

please let me know if that worked...??

Baiju KS
on 11/11/14, 1:04 AM

@Jesus and @Baiju, with id="base.menu_base_partner", there are no errors but the menuitem name does not change.

Juan Formoso
on 11/11/14, 3:36 AM
Marvin Taboada
On 11/11/14, 2:53 AM

Hello Juan, 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. E.g. Project>Configuration (source here):

    <record model="ir.ui.menu" id="mod_id.menu_id">
      <field name="name">My New Menu Name</field>

'record' XML tags are processed differently, so you only require to provide fields/values for anything you want to modify.


Edit: I created a simple module 'hr_menu_mv' to shorten the top level "Human Resources" menu to "HR", just to verify this approach, below are sources for the three files required (verified with v7.0 and v8.0):


# empty as no python modules are required to be imported


    'name': "HR Menu Mv",
    'version': "0.1",
    'category': "Human Resources",
    'depends': ['hr'],
    'data': ['hr_menu_mv_view.xml'],
    'installable': True,
    'auto_install': False,
    'application': False,


<?xml version="1.0" encoding="utf-8"?>
        <record model="ir.ui.menu" id="hr.menu_hr_root">
            <field name="name">HR</field>

I'm omitting translations just to keep the example small and readable.

This is the way I like the most, but nothing happened. I tried this: My New Menu Name --- I am sure that the XML ID of the menu I want to change is that one (base.menu_base_partner), because I am looking for it in Configuration > User interface > Menu items. I am writing that code from my customized module. Do you see anything wrong?

Juan Formoso
on 11/11/14, 3:41 AM

I am sorry, I always forget that when I paste XML tags in a comment, these ones dissapear, so I am going to edit the question so you can check what I did.

Juan Formoso
on 11/11/14, 3:54 AM

Thank you for your patience Marvin. I did exactly what you did: I created a new module with your lines (for v7) However, nothing happened again. In my case, the XML ID of the main menu option of Human Resources is "hr.menu_hr_main". I tried with both, but still nothing. I restarted and updated the service and then pressed F5. No results.

Juan Formoso
on 11/11/14, 4:41 AM

Juan, I have verified that the "base.menu_base_partner" menu entry is defined four time in v7.0 sources, once in the "base" module, and then three times in the following modules: "crm", "crm_helpdesk", "sale". If you're using any of the previous modules, chances are that your entry (either 'record' or 'menuitem') that renames "base.menu_base_partner" is not applied last (so it gets renamed to Sales again). In order to guarantee that your changes are applied last, you can declare module dependencies to any other modules that rename "base.menu_base_partner" ("crm", "crm_helpdesk", "sale") so your module will be installed after all of them.

Marvin Taboada
on 11/11/14, 4:42 AM

One minute! I have just checked my database and the record name for that menu was changed well, as you said! But for one reason I can't see the changes in the browser.

Juan Formoso
on 11/11/14, 4:47 AM

I'm racking my brains to know why I can't see the changes on the browser, I tried a lot of things, but still nothing. One thing is clear: the code you gave me is changing my database, and it's working for you, so your answer is right. I will open another question to ask about my other problem, but this one is solved. Thank you a lot for your patience, Marvin.

Juan Formoso
on 11/11/14, 5:50 AM

I had to synchronize terms to see the changes: https://www.odoo.com/forum/help-1/question/why-cant-i-see-changes-made-on-the-table-ir-ui-menu-trying-to-change-a-menuitem-67732

Juan Formoso
on 11/11/14, 9:25 AM

Baiju KS

--Baiju KS--
| 5 5 8
Kochi, India
--Baiju KS--
ODOO technical

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju KS
On 11/10/14, 11:23 PM

Try this:-

<menuitem name="New String"

Thank you! But that does not work, I get the next error: AssertionError: The ID "sale.menu_base_partner" refers to an uninstalled module. In fact, the menu I want to change is "base.menu_base_partner" (I can see it trough the OpenERP interface).

Juan Formoso
on 11/11/14, 3:34 AM
Jesús Ventosinos
On 11/1/15, 8:16 PM

if you want to override a id youn need to set the complete id module.id

Billiard R Made
On 11/10/14, 11:19 PM

Using an SQL Manager I would open ir_ui_menu and ir_ui_menu_group_rel and delete all records related to this particular Menu. Then ammend my template and update

Try code below. Paying attantion to my bold text. The two must be exact. If you put base.menu_base_partner on the first one then the bottom one must also be base.menu_base_partner

<menuitem name="My new string"
<menuitem id="base.menu_sales" parent="menu_base_partner" name=
"My new string" sequence="1" />

@Billiard, This is a wrong methodology. When you delete the record directly using SQL manager, the corresponding menus are removed. But when you update your database using -u all command, then you will have multiple menus (old+newly created menu)

Atchuthan - Technical Consultant, Sodexis Inc
on 11/11/14, 12:26 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 11/10/14, 10:59 AM
Seen: 8241 times
Last updated: 11/1/15, 8:16 PM