Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
7510 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
0
Sep 17
2775
0
Apr 17
2865
2
Sep 24
4083
5
Feb 24
24025
1
Sep 18
106