Search code examples
menuitemodoo-8odoo

How to find the id of the menu elements in Odoo?


When I activate developer mode, I'm unable to locate the menu ID that I can use as a parent in a new menu item tag. Is there a specific location within the configuration where I can find it?


Solution

  • There are two ways of declaring a menuitem:

    • With a shortcut. You can search the string that you see in the interface. This string is going to be the attribute name of the menuitem. If you want to search the menuitem of this example you should search the string name="Human readable name" in the Odoo source code:
    <menuitem id="menu_human_readable_name" 
              name="Human readable name" 
              parent="base.menu_custom" 
              sequence="10" 
              action="action_name" />
    
    • It's also possible declare the menuitem as a record of the ir.ui.menu model. In this case you should search the string <field name="name">Human readable name</field> in order to find the menu item
    <record id="menu_human_readable_name" model="ir.ui.menu" >
        <field name="name">Human readable name</field>
        <field name="sequence" eval="10" />
        <field name="action" ref="action_name" />
        <field name="parent_id" ref="base.menu_custom" />
    </record>
    

    There is another option: you can go to the table where you can see or search the string of the menuitem in the interface: Settings > Technical > User Interface > Menu items

    Maybe there are any other way to search them, but I am unaware of it.

    I hope this helps you