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

Unable to Apply XPath Highlight to the Phone Field input Inside POS Partner Details

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
posContactForm
2 Respostas
150 Visualizações
Avatar
abdo

I'm trying to highlight two fields inside the POS Partner Details popup: Name and Phone.

  • Highlighting the Name input works correctly using XPath.

  • But the Phone input is generated inside a t-foreach loop, and its t-attf-name attribute is dynamic, so my XPath never reaches this element, like..

<t t-foreach="['Street','City','Zip','Email','Phone','Mobile','Barcode']" t-as="item">...</t>

my xpath :

<t t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">    
​<xpath expr="//input[@name='name']" position="attributes">
​ ​<attribute name="style">border: 2px solid #1e90ff !important;</attribute> ​ ​</xpath>

​<xpath expr="//input[@name='phone']" position="attributes">
​ ​<attribute name="style">border:2px solid #1e90ff !important;</attribute> ​ ​</xpath>
</t>


Since the input for Phone is created dynamically inside the loop, I can’t select it with a static XPath like:

//input[@t-attf-name="Phone"]

I tested multiple XPath approaches, but none of them can match the Phone input inside the t-foreach. The rendered DOM is correct in the browser, but XPath inheritance in QWeb can’t target the loop items individually.

Goal: I only want to style the Phone input inside the POS Partner Details, without affecting the other fields.

Problem: XPath inheritance cannot target this specific input because it's created from a loop, so it matches all fields or none.

If anyone has a clean workaround (either correct QWeb targeting or a recommended JS-only POS patch), please advise.

0
Avatar
Cancelar
Codesphere Tech

Hello,
<t t-name="l10n_pe_pos.PartnerDetailsEdit" t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">
<xpath expr="//div[input[@t-attf-name='{{item}}']]" position="attributes">
</xpath>

Have you tried like this? Taken from odoo base.

Avatar
abdo
Autor Melhor resposta

Thank you for the suggestions and support.

I tried all the recommended XML and JS approaches including inheriting the loop, patching the widget, and using DOM observers but unfortunately the Phone field still isn’t being targeted correctly in my POS setup.

I appreciate all the help shared so far, but the issue remains unresolved on my side.

Thanks again to everyone who took the time to reply.

0
Avatar
Cancelar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Melhor resposta
Hi,

To style only the Phone field, you must modify the loop itself or use JavaScript. The clean XML approach is to inherit the loop and check when the loop variable equals "Phone", injecting attributes only in that iteration. This allows adding styles without affecting other fields. The more robust approach—often recommended for POS—is using a small JavaScript patch. With JS, you can target the rendered "phone" input directly in the DOM after the widget is mounted and apply your custom styling.

JS

odoo.define('your_module.partner_edit_highlight', function (require) {
    "use strict";

    const { patch } = require("@web/core/utils/patch");
    const PartnerDetailsEdit = require("point_of_sale.PartnerDetailsEdit");

    patch(PartnerDetailsEdit.prototype, "highlight_phone_field", {
        mounted() {
            this._super(...arguments);
            const phoneInput = this.el.querySelector("input[name='phone']");
            if (phoneInput) {
                phoneInput.style.border = "2px solid #1e90ff";
            }
        },
    });
});

XML

<t t-inherit="point_of_sale.PartnerDetailsEdit" t-inherit-mode="extension">

    <!-- Match the foreach loop -->
    <xpath expr="//t[@t-foreach]" position="inside">
        <t t-if="item == 'Phone'">
            <attribute name="style">border: 2px solid #1e90ff !important;</attribute>
        </t>
    </xpath>

</t>

In short: pure XPath cannot affect dynamically generated elements, so the solution is either inherit the loop or patch the widget in JS. Both methods safely highlight only the Phone input without modifying other fields.



Hope it helps

0
Avatar
Cancelar
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
Kitchen printing printer other than odoo provided list
pos
Avatar
Avatar
1
nov. 25
70
POS Table Synchronization Issue Between Devices in Odoo v17 CE
pos
Avatar
Avatar
Avatar
2
nov. 25
2551
Refund and Discount access to admin user only for Pos selling
pos
Avatar
Avatar
1
nov. 25
423
Error in POS with gift cards when testing upgrade to 18
pos
Avatar
Avatar
Avatar
Avatar
3
out. 25
2258
How to Restrict POS Sales When Product Stock is Zero (Odoo Online 19)
pos
Avatar
Avatar
Avatar
2
out. 25
1291
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