Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

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

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

How to target templates, with an ID of template.

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
templatesxpathodoo16features
4 Respostas
5526 Visualizações
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
Cancelar
Avatar
Shepai Ellyn
Melhor resposta

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

1
Avatar
Cancelar
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
Melhor resposta

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
Cancelar
Avatar
shubham shiroya
Melhor resposta

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
Cancelar
Avatar
Ross
Autor Melhor resposta

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
Cancelar
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>

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
v16 web.TranslationDialogWidget Extension not working
templates odoo16features
Avatar
0
mar. 23
2246
Where is the docs variable used in the template defined?
templates reporting odoo16features
Avatar
Avatar
1
mar. 24
2347
odoo16: how to reference <t element in xpath expr
template xpath odoo16features
Avatar
Avatar
Avatar
2
mar. 24
3911
Project Templates
templates projects odoo16features
Avatar
Avatar
2
jul. 23
10003
report odoo16 Resolvido
templates report odoo16features
Avatar
Avatar
1
fev. 23
9665
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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