Skip to Content
Odoo Menu
  • Sign in
  • Teste-o gratuitamente
  • Aplicações
    Finanças
    • Contabilidade
    • Faturação
    • Despesas
    • Folha de cálculo (BI)
    • Documentos
    • Assinatura eletrónica
    Vendas
    • CRM
    • Vendas
    • POS para lojas
    • POS para restaurantes
    • Subscrições
    • Aluguer
    Sites
    • Criador de Sites
    • Comércio eletrónico
    • Blogue
    • Fórum
    • Chat em direto
    • e-Learning
    Cadeia de abastecimento
    • Inventário
    • Produção
    • PLM
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Colaboradores
    • Recrutamento
    • Ausências
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Marketing social
    • Marketing por e-mail
    • Marketing através de SMS
    • Eventos
    • Automação de Marketing
    • Inquéritos
    Serviços
    • Projeto
    • Registos de Horas
    • Assistência no local
    • Assistência
    • Planeamento
    • Agendamentos
    Produtividade
    • Conversas
    • Inteligência artificial
    • IoT
    • VoIP
    • Informação
    • WhatsApp
    Aplicações de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Retalho
    • Livraria
    • Loja de roupa
    • Loja de móveis
    • Mercearia
    • Loja de ferragens
    • Loja de brinquedos
    Alimentação e hotelaria
    • Bar e pub
    • Restaurante
    • Comida rápida
    • Casa de hóspedes
    • Distribuidor de bebidas
    • Hotel
    Imobiliário
    • Agência imobiliária
    • Gabinete de arquitectura
    • Construção
    • Gestão imobiliária
    • Jardinagem
    • Associação de proprietários
    Consultoria
    • Gabinete de contabilidade
    • Parceiro da Odoo
    • Agência de marketing
    • Sociedade de advogados
    • Aquisição de talentos
    • Auditoria e certificação
    Produção
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Brindes promocionais
    Saúde e bem-estar
    • Clube desportivo
    • Ótica
    • Ginásio
    • Profissionais de bem-estar
    • Farmácia
    • Cabeleireiro
    Ofícios
    • Handyman
    • Hardware e suporte técnico
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência do ambiente
    • Aluguer de painéis publicitários
    • Estúdio de fotografia
    • Aluguer de bicicletas
    • Revendedor de software
    Explorar todos os setores
  • Comunidade
    Aprender
    • Tutoriais
    • Documentação
    • Certificações
    • Treino
    • Blogue
    • Podcast
    Capacitar a educação
    • Programa de formação
    • Scale Up! O jogo de negócios
    • Visite a Odoo
    Obter o software
    • Transferir
    • Comparar Edições
    • Versões
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Registe a sua empresa contabilística
    • Programa de afiliados
    Obter serviços
    • Encontre um parceiro
    • Encontre um contabilista
    • Contacte um consultor
    • Serviços de implementação
    • Referências de clientes
    • Apoio
    • Atualizações
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar uma demonstração
  • Preços
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Select multiple elements with XPath

Subscribe

Get notified when there's activity on this post

This question has been flagged
views
5 Replies
52292 Views
Avatar
Michael Leff

I have seen a few similar questions on this but can't seem to find a solution. According to the XPath syntax here:

https://www.w3schools.com/xml/xpath_syntax.asp

An expression like this should match all buttons with name="action_rfq_send":

//button[@name='action_rfq_send']

However, the Odoo documentation for view inheritance says that the first node found from an xpath expression is the one selected:

http://www.odoo.com/documentation/10.0/reference/views.html#inheritance

Does this mean there is no way to select multiple nodes with one xpath expression in Odoo? If the view I'm extending has 3 buttons with name="action_rfq_send", is there any way to select them all with a single expression?

0
Avatar
Discard
Sehrish

xpath tips: https://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

Avatar
Janeesh
Best Answer

You cannot select all with a single xpath expression. You have to select one by one if more than one button with same name needs to referenced. Like:

<xpath expr="//button[@name='action_rfq_send'][1]" position="after">
</xpath>
<xpath expr="//button[@name='action_rfq_send'][2]" position="after">
</xpath>
8
Avatar
Discard
Ray Carnes (ray)

odoo xpath nth

Avatar
Representaciones Arequipa S.R.L.
Best Answer

You need to use parentheses around the xpath expression and from there use the index.


expr = "(//button[@name='action_rfq_send'])[1]"

expr = "(//button[@name='action_rfq_send'])[2]"

expr = "(//button[@name='action_rfq_send'])[3]"


1
Avatar
Discard
Avatar
Ray Carnes
Best Answer

I don't know how to do it with one expression, but you can do this:

<xpath expr="//form/group[1]" ...
<xpath expr="//form/group[2]" ...
<xpath expr="//form/group[3]" ...
1
Avatar
Discard
Avatar
Juan Sandoval
Best Answer

In my case using numbers fails.

Just repeat the same expression as many times as you need:
<xpath expr="//button[@name='action_rfq_send']" position="after"></xpath>
<xpath expr="//button[@name='action_rfq_send']" position="after"></xpath>

1
Avatar
Discard
Avatar
Mahmoud Abdelwahid
Best Answer

The Xpath code will be such as:

<xpath expr="//button[@name='action_rfq_send'][1]" ...............>

<xpath expr="//button[@name='action_rfq_send'][2]" ...............>

<xpath expr="//button[@name='action_rfq_send'][3]" ...............>

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Filter out (hide) lines in tree component Solved
views
Avatar
Avatar
Avatar
2
abr. 24
5444
What are the different types of views available in Odoo? Solved
views
Avatar
Avatar
Avatar
Avatar
3
jun. 23
11194
view layout (two fields on the same row within an xpath) Solved
views
Avatar
Avatar
2
jun. 23
7897
Create view without model, only with buttons and text
views
Avatar
Avatar
Avatar
3
mar. 23
13057
click button to go to another view and along with current view data to the new view Solved
views
Avatar
Avatar
1
mar. 23
4970
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Código aberto
  • Transferir
  • Github
  • Runbot
  • Traduções
Serviços
  • Alojamento Odoo.sh
  • Apoio
  • Atualizar Versão
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um contabilista
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • A Nossa Empresa
  • Ativos da marca
  • Contacte-nos
  • Trabalhos
  • Eventos
  • Podcast
  • Blogue
  • 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) Português română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

O Odoo é um conjunto de aplicações empresariais de código aberto que abrange todas as necessidades da sua empresa: CRM, comércio eletrónico, contabilidade, gestão de inventário, ponto de venda, gestão de projetos, etc.

A proposta de valor única do Odoo é ser, ao mesmo tempo, muito fácil de utilizar e totalmente integrado.

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