За замовчуванням¶
Odoo automatically generates some basic menu items depending on the apps you installed. For example, the Website app adds two items to the main menu. These items are linked to pages, which are also automatically created.
Delete default menu items.
/website_airproof/data/menu.xml
¶<!-- Contact us -->
<delete model="website.menu" search="[('url','in', ['/', '/contactus']),
('website_id', '=', 1)]"/>
<!-- Shop -->
<delete model="website.menu" search="[('url','in', ['/', '/shop']),
('website_id', '=', 1)]"/>
New window¶
Open the link’s URL in a new tab.
<record id="..." model="website.menu">
<field name="new_window" eval="True"/>
</record>
External Links¶
Add a link to an external website.
<record id="..." model="website.menu">
<field name="url">https://www.odoo.com</field>
</record>
Anchor¶
Link to a specific section of a page.
<record id="..." model="website.menu">
<field name="url">/about-us#our-team</field>
</record>
Користувацький шаблон¶
Створіть власний шаблон і додайте його до списку.
Макет
/website_airproof/views/website_templates.xml
¶<template id="s_mega_menu_airproof" name="Airproof" groups="base.group_user">
<section class="s_mega_menu_airproof o_cc o_cc1 pt40">
<!-- Content -->
</section>
</template>
Параметр
Використайте наступний код, щоб додати опцію для вашого нового власного мегаменю у Конструкторі веб-сайтів.
/website_airproof/views/snippets/options.xml
¶<template id="snippet_options" inherit_id="website.snippet_options" name="Airproof - Mega Menu Options">
<xpath expr="//*[@data-name='mega_menu_template_opt']/*" position="before">
<t t-set="_label">Airproof</t>
<we-button t-att-data-select-label="_label"
data-select-template="website_airproof.s_mega_menu_airproof"
data-img="/website_airproof/static/src/img/builder/header_opt.svg"
t-out="_label"/>
</xpath>
</template>