Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4977 Ansichten

I am currently trying to inherit a template that resides in my customer website theme. 
The template is defined as such:

<template id="template_header_custom" inherit_id="website.layout" name="Template Header custom" active="True">
<xpath expr="//header//nav" position="replace">
<nav data-name="Navbar" class="navbar navbar-expand-lg navbar-light flex-lg-column o_colored_level o_cc py-0">
  new nav code... 
</nav>
  </xpath>
</template>
I have created a custom module to inherit this using the code:

<template id="template_header_custom_prod_cat" inherit_id="theme_walker_rubber.template_header_custom" name="Template Header custom Prod Cat"> 
<xpath expr="//nav" position="after">
</xpath>
</template>
 The custom module has a dependency on the the theme, however, it still throughs an error saying the the nav element cant be found in the document.
Using Odoo v14.
Avatar
Verwerfen

Please format the code with proper line breaks for better reading.

Autor

It had proper formatting at time of completion, ill try fix it

Beste Antwort

There are some points which should be checked and can help with such problems.

- in the Website Builder, there is a Customization Menu, which allows to check/uncheck options in the current page. These options lead to activation/deactivation of corresponding QWeb views. In the views this is managed by the "active" attribute. If an option is not active, you can not inherit elements from its view.

- A very nice post here: https://dev.to/opencode/don-t-break-your-and-others-odoo-xml-373i

- Use an Xpath-Tester 

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Juni 22
3381
1
Apr. 22
2229
0
Feb. 22
4536
1
Jan. 22
2223
1
Jan. 21
3113