Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to target templates, with an ID of template.

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
templatesxpathodoo16features
4 Antwoorden
5529 Weergaven
Avatar
Ross

Hi,

I want to add the default code to the website search bar dropdown, but i'm unsure how to target this particular template. 

The template is found here: addons/website/static/src/snippets/s_searchbar/000.xml

id="template"

t-tname="website.s_searchbar.autocomplete"

Any advice would be appreciated.


Thanks,

Ross.

0
Avatar
Annuleer
Avatar
Shepai Ellyn
Beste antwoord

You can try below. I think it is what you are looking for.

1
Avatar
Annuleer
Shepai Ellyn

Add this code to your view...
<template id="assets_frontend" inherit_id="website_sale.assets_frontend">
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/module_name/static/src/scss/style.scss"/>
</xpath>
</template>
For reports...
<template id="report_assets_common" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/scss" href="/module_name/static/src/scss/style.scss"/>
</xpath>
</template>
@https://helixjumponline.com

Avatar
Support GeminateCS
Beste antwoord

Hii Ross,
If you want to target and add particular fields of your model , you can achieve this by adding this in xml,
id='your_custom_template'  inherit_id='Module_name.Template_ID'
//your functionality of code

and if you want to replace the whole template 
id='Module_name.Template_ID'  name='Name of Template'
//your functionality of code

I Hope this information will helpful for you.
Feel free for further Assistance on contact@geminatecs.com
Thank You,
Geminate Consultancy Services
w : www.geminatecs.com

1
Avatar
Annuleer
Avatar
shubham shiroya
Beste antwoord

you can create a custom module and inherit the existing template to make the necessary modifications. Here's a step-by-step guide:

  1. Create a new custom module (e.g., custom_website) with the necessary module structure.

  2. Inside your custom module, create a new XML file (e.g., custom_searchbar_templates.xml) and define your modifications. The file should be placed in the static/src/snippets/ directory of your custom module.

  3. In the XML file, inherit the existing template (website.s_searchbar.autocomplete) using the template tag with the inherit_id attribute. Set the inherit_id value to the original template's id attribute.

  4. Within the inherited template, add your default code or modifications.

Here's an example of how your custom_searchbar_templates.xml file might look:

templates id="template" xml:space="preserve">
t t-extend="website.s_searchbar.autocomplete">
#!-- Inherit the existing template 
t t-inherit="website.s_searchbar.autocomplete">
#Add your modifications or default code 
            # For example, adding a default search suggestion 
t t-set="search_suggestion" t-value="'Your default search suggestion'"/>
/t>
/t>
/templates>


in your custom module's manifest file (__manifest__.py), make sure to include the XML file by adding it to the data section:

1
Avatar
Annuleer
Avatar
Ross
Auteur Beste antwoord

Hi shubham shiroya,

I get the following error:

AssertionError: Element odoo has extra content: templates, line 3
XML:

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

odoo>

​templates id="template" xml:space="preserve">

​​t t-extend="website.s_searchbar.autocomplete">

​ ​​t t-inherit="website.s_searchbar.autocomplete">

​​​ ​t t-set="search_suggestion"t-value="'Your default search suggestion'"/>

​ ​​/t>

​ ​/t>

​/templates>

/odoo>

0
Avatar
Annuleer
shubham shiroya

try this code:
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="website.s_searchbar.autocomplete">
<!-- Add your modifications to the template here -->
<!-- For example, add a default code -->
<t t-jquery=".dropdown-item" t-operation="append">
<li class="dropdown-item" role="option" data-autocomplete-code="your_default_code">Your Default Code</li>
</t>
</t>
</templates>

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
v16 web.TranslationDialogWidget Extension not working
templates odoo16features
Avatar
0
mrt. 23
2247
Where is the docs variable used in the template defined?
templates reporting odoo16features
Avatar
Avatar
1
mrt. 24
2348
odoo16: how to reference <t element in xpath expr
template xpath odoo16features
Avatar
Avatar
Avatar
2
mrt. 24
3916
Project Templates
templates projects odoo16features
Avatar
Avatar
2
jul. 23
10004
report odoo16 Opgelost
templates report odoo16features
Avatar
Avatar
1
feb. 23
9667
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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