Help

3

add top menu item in custom module

Avatar
shafeequemonp

I need to create a menu item on top just before the settings item.can anyone help me ...

Avatar
Discard
3 Answers
3
Avatar
René Schuster
Best Answer

Create a xml for your custom module.

<openerp>
    <data>
        <menuitem name="Your Menu Name" id="your_menu_id" sequence="450"/>
    </data>
</openerp>

Make sure the xml file is listed in your __openerp__.py file for your custom module.

A few notes:

  • The sequence gives the order for your menu items (low to high), 'Settings' menu got sequence 500, 'Reporting' menu got sequence 170
  • for submenues you can use the parent attribute inside the menu tag: e.g. parent="menu_hr_root". If you leave this attribute your menu item will be at the very top
  • to manage the visibility for your menu item, you can use the groups attribute inside the menu tag: e.g. groups="base.group_user".

EDIT:

A few more notes:

  • If you leave the groups attribute the menuitem will be visible to everyone
  • OpenERP seems to be 'smart'. A menu item will first become visible after it (or any sub menu) has an actual action to perform something
  • the menuitem tag for xml views is used to create all menues on any hierarchy level. The actual hierarchy is controlled by the parent attribute.

EDIT2:

Example for a menu hierarchy:

<openerp>
    <data>
        <menuitem name="Your Root Menu Name" id="your_root_menu_id" sequence="450"/>
        <menuitem name="Your Sub Menu Category Name" id="your_sub_menu_category_id" parent="your_root_menu_id" sequence="10"/>
        <menuitem name="Your Sub Menu Name" id="your_sub_menu_id" parent="your_sub_menu_category_id" sequence="5"/>
        <menuitem name="Another Sub Menu" id="another_menu_id" parent="your_sub_menu_category_id" sequence="10"/>
    </data>
</openerp>

I recommend assigning actions to the lowest menu level only. (I'm not sure whether you can add a fourth level)

3 Comments
Avatar
Discard
Avatar
shafeequemonp
-

thanks sir ...fixed it and now need to create sub menus in left side when i click my root menu item..how can i do it ..may u please help..

Avatar
shafeequemonp
-

k..sir while i creating more sub menus on root menu its not appearing ..how should i give the sequence number..

Avatar
shafeequemonp
-

its fixed..

0
Avatar
om
Best Answer

than you have the external id of that menu item ...........

once it's fetched put that link into your menu...like ex:-

<menuitem id="something" parent="[fetched external id]" name="something_else"/>

please give proper external id to show that menu under the main men


Avatar
Discard
-1
Avatar
Salim hachemaoui
Best Answer

 want to create a sub menus in the main menu in sale / crm .someone can help me ?

Avatar
Discard