Skip to Content
Menu
This question has been flagged
1 Reply
2976 Views
hello

I wanted to change the appearance of the default site header in the website template.
But when I put the Odoo code in an xml page by changing the ID, I get the following error:

odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
ValueError: Element '' cannot be located in parent view
Template: 776
Path: /t/t
Node:



Part of the code I ran:

xml version="1.0" encoding="utf-8"?>



id="My_template_header" inherit_id="website.layout" name="My Template Header Default" active="True">
expr="//header//nav" position="replace">
t-call="website.navbar">
t-set="_navbar_classes" t-valuef="shadow-sm"/>
id="top_menu_container" class="container justify-content-start justify-content-lg-between">

t-call="website.placeholder_header_brand">
t-set="_link_class" t-valuef="me-4"/>


Please guide me so that I can change the appearance of header through Odoo template.


Avatar
Discard
Best Answer

Hello, @mohammad hosein saeedian


Hope you are doing well,

For you to solve the issue of navbar you will need to do the following changes.

- First of all, you need to inherit website navbar template.
- After that you can inherit website header and call navbar template.

Please find code in comment. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

Here is a reference code:

<template id="custom_navbar" name="Navbar" inherit_id="website.navbar">
<xpath expr="//nav" position="replace">
<nav class="custom_navbar">
<ul>
<li>DEMO1
</li>
<li>DEMO2
</li>
</ul>
</nav>
</xpath>
</template>

<template id="My_template_header" inherit_id="website.layout" name="My Template Header Default" active="True">
<xpath expr="//header" position="replace">
<t t-call="website.navbar"/>
</xpath>
</template>

Related Posts Replies Views Activity
1
Nov 22
3542
0
Nov 24
51
0
Jul 24
224
1
Jul 24
778
0
Aug 24
339