Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Using qWeb templates in custom website theme

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
website
2 Odpowiedzi
3283 Widoki
Awatar
Luis H. Porras

Hi everyone, I'm trying to develop a custom theme for my odoo (v13) website but I'm struggling to create templates using qWeb and calling odoo defined templates like:


<template id="template_header_custom" inherit_id="website.layout" name="Template Header Cutsom" active="True">

<xpath expr="//header//nav" position="replace">

<h1>Custom header</h1>

<div>

<t t-call="website.navbar_nav">

<t t-set="_nav_class" t-valuef="me-auto"/>


<!-- Menu -->

<t t-foreach="website.menu_id.child_id" t-as="submenu">

<t t-call="website.submenu">

<t t-set="item_class" t-valuef="nav-item"/>

<t t-set="link_class" t-valuef="nav-link"/>

</t>

</t>

</t>

</div>

</xpath>

</template>

As soon as I invoque a website addon template I get the following error (once I've loaded the theme, navigate to the website home):


Error Message:
load could not load template ValueError: View 'website.navbar_nav' in website 1 not found Template: website.layout Path: /t/html/body/div/header/div[2]/t

How am I supposted to load these templates so I can create a custom dynamic layout for my theme?


0
Awatar
Odrzuć
Luis H. Porras
Autor

Hi, thanks for the quick replay.

Yes in fact I've checked the three points:

  • website.navbar_nav template definition.
  • Manifest:

{

'name': 'Custom theme',

'description': 'Odoo custom theme',

'version': '1.0',

'author': 'Luis H. Porras',

'category': 'Theme/Creative',

'depends': ['website', 'website_theme_install'],

'data': [

'views/assets.xml',

'views/layout.xml',

'views/pages.xml',

'views/snippets.xml',

'views/options.xml'

],

}

  • And code correctess, well, the code it's been copy/pasted

So I understand from your replay that I'm doing the process as expected but for some reason I don't get the desired output. Searching in the design_themes repo I also found this approach but didn't work either:

theme_models.py

from odoo import models


class CustomTheme(models.AbstractModel):

_inherit = 'theme.utils'


@property

def _header_templates(self):

return ['theme_custom.template_header_custom'] + super()._header_templates


@property

def _footer_templates(self):

return ['theme_custom.template_footer_custom'] + super()._footer_templates


def _theme_custom_post_copy(self, mod):

self.enable_view('theme_custom.template_header_custom')

self.enable_view('theme_custom.template_footer_custom')

__init__.py (under models subfolder)

from . import theme_models

__init__.py (main folder)

from . import models

Any other ideas on how to debug this or any other workaround?

Thanks!

Awatar
Asliddin Maxmudov
Najlepsza odpowiedź
  • Ensure Template Availability: Confirm that the website.navbar_nav and website.submenu templates exist in the website module. If they are not loaded or accessible, you won't be able to call them in your custom template.
  • Check for Module Dependencies: Make sure your custom theme module has a dependency on the website module. In the __manifest__.py file of your theme module, you should have:

'depends': ['website'],
  • Correct Template Call: Ensure that the template you're calling exists in the correct format and the call is made correctly. In your case, t-call="website.navbar_nav" and t-call="website.submenu" seem correct, but double-check that these templates are properly defined in the website module.
1
Awatar
Odrzuć
Luis H. Porras
Autor

Hi, thanks for the quick replay.

Yes in fact I've checked the three points:

website.navbar_nav template definition.
Manifest:

{

'name': 'Custom theme',

'description': 'Odoo custom theme',

'version': '1.0',

'author': 'Luis H. Porras',

'category': 'Theme/Creative',

'depends': ['website', 'website_theme_install'],

'data': [

'views/assets.xml',

'views/layout.xml',

'views/pages.xml',

'views/snippets.xml',

'views/options.xml'

],

}

And code correctess, well, the code it's been copy/pasted

So I understand from your replay that I'm doing the process as expected but for some reason I don't get the desired output. Searching in the design_themes repo I also found this approach but didn't work either:

theme_models.py

from odoo import models

class CustomTheme(models.AbstractModel):

_inherit = 'theme.utils'

@property

def _header_templates(self):

return ['theme_custom.template_header_custom'] + super()._header_templates

@property

def _footer_templates(self):

return ['theme_custom.template_footer_custom'] + super()._footer_templates

def _theme_custom_post_copy(self, mod):

self.enable_view('theme_custom.template_header_custom')

self.enable_view('theme_custom.template_footer_custom')

__init__.py (under models subfolder)

from . import theme_models

__init__.py (main folder)

from . import models

Any other ideas on how to debug this or any other workaround?

Thanks!

Luis H. Porras
Autor

Hi Asliddin, I was re-reading your answer and wonder if there is a specific way of checking he availability of the templates in run-time as my response to your answer is based in checking the official repo code.

Awatar
Luis H. Porras
Autor Najlepsza odpowiedź

Re-reading Asliddin answer I've found the  problem. 

In fact the template website.navbar_nav doesn't exist in Odoo v13.0 yet. My former link to  the code is pointing to a later version of Odoo.


0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How do I remove the numbers from the slugs in my blog and blogpost? Rozwiązane
website
Awatar
Awatar
Awatar
Awatar
3
wrz 25
2683
Login Website Rozwiązane
website
Awatar
3
paź 25
149265
500 Server Error after upgrading from 18.0 to 18.4 Odoo Online
website
Awatar
Awatar
1
wrz 25
2088
Can't delete website Rozwiązane
website
Awatar
Awatar
Awatar
Awatar
Awatar
4
wrz 25
7044
How to Hide website Menus based on Groups
website
Awatar
Awatar
Awatar
2
sie 25
2211
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now