Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
7524 Visninger

Hi, I am working on odoo 10, in that i need to add a submenu called "Category" under "Shop" menu. While using "edit" option in website it is easy to add.. and its working properly but instead of using "Edit" i would like to add the submenu from coding itself..

So, when i try to add using coding its not coming under "shop" menu it will add "category" option next to the "shop" menu

Eg: From coding

it will add the category next to shop..


Eg: using Edit option on website

it will add the category under shop menu. This is what i need from coding itself..

can anyone help me to get the "category" submenu under the "shop" menu..


Avatar
Kassér
Bedste svar

Odoo deals with menus by using website.menu model.

By the way, it is designed as a Nested Model.

https://en.wikipedia.org/wiki/Nested_set_model

You have to do is that just insert a new record with field parent_id here because Odoo makes up menu tree automatically.

Heres example

<?xml version="1.0" encoding="utf-8"?>
<odoo>
     <record id="submenu_item1" model="website.menu">
         <field name="name">Submenu 1</field>
<field name="url">/page/test</field>
<field name="parent_id" ref="website_sale.menu_shop" />
     </record>
</odoo>



See this line

<field name="parent_id" ref="website_sale.menu_shop" />

Attribute ref is an XML ID. You can search it at Settings -> Sequence & Identifiers -> External Identifiers.

Input website.menu on searching form with Model Name condition then you can see the list of menus.

Avatar
Kassér
Bedste svar

Hello Silviaa,
We hope this will help you to resolve your problem.


https://apps.odoo.com/apps/modules/13.0/website_multi_menu_submenu_oin/


Thank you.
Skype: live:info_850626 OR (info@odooitnow.com)

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
sep. 17
2784
0
apr. 17
2878
2
sep. 24
4202
5
feb. 24
24063
1
sep. 18
106