Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Adding an HTML element to existing website template

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
website_builderwebsite
1 Antworten
1801 Ansichten
Avatar
Hein Htet Aung

The Odoo website has a default 'Contact Us' button in its Navbar. 

--------------

|  Contact Us |

---------------

The existing template for 'Contact Us' button (id=website.header_call_to_action) is  located in webiste_templates.xml and it was coded as follows. 

<template id="website.header_call_to_action" inherit_id="website.placeholder_header_call_to_action" name="Header Call to Action" active="True">
<xpath expr="." position="inside">
<li t-attf-class="#{_item_class}">
<div t-attf-class="oe_structure oe_structure_solo #{_div_class}">
<section class="oe_unremovable oe_unmovable s_text_block" data-snippet="s_text_block" data-name="Text">
<div class="container">
<a href="/contactus" class="oe_unremovable btn btn-primary btn_cta">Contact Us</a>
</div>
</section>
</div>
</li>
</xpath>
</template>


I just wanted to add a new <span> element inside <a> tag of above template as follows. (I already have a module created with the name 'mytheme')

<template id="mytheme.header_call_to_action" inherit_id="website.header_call_to_action" name="Header Call to Action"
active="True">
<xpath expr="//a[hasclass('oe_unremovable')]" position="inside">
<span class="badge rounded-pill">Free</span>
</xpath>
</template>


 I added the above code('My Custom Call to Action') inside an xml file called 'custom_header.xml' which was inherited from 'website.layout'

<odoo>
<template id="header" inherit_id="website.layout" name="My Custom Header">
<xpath expr="//header" position="replace">
<nav>
<t t-call="website.navbar">
<t t-set="_nav_class" t-valuef="navbar"/>
<div class="container-fluid">
<!-- Brand -->
<t t-call="website.placeholder_header_brand">
<t t-set="_link_class" t-valuef="navbar-brand d-flex align-items-center"/>
</t>

<div class="d-flex align-items-center gap-2">
<!-- My Custom Call To Action -->
<t t-call="mytheme.header_call_to_action"/>
</div>
</div>
</t>
</nav>
</xpath>

</template>



<!-- My Custom Call To Action -->
<template id="mytheme.header_call_to_action" inherit_id="website.header_call_to_action" name="Header Call to Action"
active="True">
<xpath expr="//a[hasclass('oe_unremovable')]" position="inside">
<span class="badge rounded-pill">Free</span>
</xpath>
</template>
</odoo>



Here is the error message I received. Thanks in advance for your suggestions. 

Error message:

Error while render the template
ValueError: View 'mytheme.header_call_to_action' in website 1 not found
Template: website.layout
0
Avatar
Verwerfen
Avatar
D Enterprise
Beste Antwort

Hiii,

Since you're extending ( inherit_id ) the existing website.header_call_to_action, you should not call mytheme.header_call_to_action directly.

Instead, continue to use the original ID — it will include your change automatically.

Updated Code

<odoo> <template id = "mytheme.header_call_to_action" inherit_id = "website.header_call_to_action" name = "Header Call to Action" > <xpath expr = "//a[hasclass('oe_unremovable')]" position = "inside"> < span class = "badge rounded-pill" >Free </ span > </xpath> </template> <template id = "header" inherit_id = "website.layout" name = "My Custom Header"> <xpath expr = "//header" position = "replace"> <nav> <t t-call = "website.navbar"> <tt-set="_nav_class" t-valuef="navbar"/> <div class = "container-fluid"> <t t-call = "website.placeholder_header_brand" > <t t-set="_link_class" t-valuef="navbar-brand d-flex align-items-center"/> </t> <div class = "d-flex align-items-center gap-2"> <!-- Use the original ID --> <t t-call = "website.header_call_to_action"/> </div> </div> </t> </nav> </xpath> </template> </odoo>

I hope it is usefull

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
How do i re-run the website builder to include the demo theme? Gelöst
website_builder website
Avatar
Avatar
Avatar
2
Sept. 25
4378
How to add lottie animation to odoo site
website_builder website
Avatar
Avatar
Avatar
2
Juni 25
3287
Website - how to ask for email before allowing download of a pdf Gelöst
website_builder website
Avatar
Avatar
Avatar
3
Apr. 25
3251
Calculator on website
website_builder website
Avatar
Avatar
1
Apr. 25
4115
Place a button over an image/banner. Can do it on desktop view but not mobile view. Possible?
website_builder website
Avatar
Avatar
1
Dez. 24
3234
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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