Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
7508 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
set 17
2774
0
apr 17
2865
2
set 24
4055
5
feb 24
24023
1
set 18
106