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

Multiple condition in XML is not working. What could be wrong?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
xmlconditionOdoo12.0
1 Responder
16404 Visualizações
Avatar
Paulo Matos

Hello everyone,

I am using Odoo 12 for this purpose
I am having a problem that seems to easy to solve but I simple do not understand where is the problem.

I have a button for which I need to set visibility based on 2 conditions. In this case I am using the button "attributes".

 The conditions are based on 2 fields and if I test the attribute using only one condition at a time, it works as expected:

      Condition 1: ... attrs="{'invisible':[('active','=', False)]}" ...
      Condition 2: ... attrs="{'invisible':[('state','!=','confirm')]}" ...

 In the example above, using the first condition, the button is only shown for all active records. And for the second condition, the button is only shown on records which "state" field is not 'confirm'. So I can confirm that conditions work as expected.

Now, I need to join both conditions on the same button attribute in order to test them with AND operator. I have tried:

     ... attrs="{'invisible':[('active','=', False),('state','!=','confirm')]}" ...

Does not work and also tried with ('state','not in','confirm') and ('active','!=', True).
There's no errors but I am sure none of the conditions is being applied and the button is shown everywhere.

Tried to use a '&':

     ... attrs="{'invisible':['&',('active','=', False),('state','!=','confirm')]}" ...

but I get an error 'doc = etree.parse(xmlfile)....'

Tried to use the corresponding special html character for &  ( & ).
The same result as the first situation. No errors but the conditions are not working.

What could be wrong?

I can ensure that I have records that must meet any of the conditions.

Thank you very much

Regards

PM

0
Avatar
Cancelar
Avatar
Anoop Menon
Melhor resposta

use  attrs="{'invisible':['|', ('active','=', False),('state','!=','confirm')]}"

i believe what you need is an 'or' condition . remember that you are trying to make it invisible for both cases , so it is an 'or' condition and not an 'and' condition

invisible if condition 1 'or' condition 2

 


 

6
Avatar
Cancelar
Paulo Matos
Autor

Dear @Anoop, thank you for the reply.

In fact I do want to make invisible for both cases. I do not need an OR condition. I need an AND condition in order to hide records that meet both conditions.

Thank you

Anoop Menon

Did you try the fields view get option and checked what is getting loaded as attrs for this field?

Paulo Matos
Autor

Sorry everyone, sorry @Anoop,

I found the problem.

It is not related with the code it self. The problem is on the argument I was using for running Odoo server.

In order to prevent to always restart the server (with -u module_name argument) for the xml changes to be effective, I was using the --test-enable argument also.

This allows me to see the changes immediatelly just by refreshing the browser (besides running tests if they exist).

For some reason I don't know, the AND condition is not being correctly read with this argument.

Remove it and the code is working

...today's lesson: in case of doubt, review the start-up arguments and mannually upgrade the modules.

Thank you all once again

PM

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
Working with xml and xsd... how to? Resolvido
xml xsd Odoo12.0
Avatar
Avatar
1
ago. 20
6329
Declare a field, get its value but not save it on database Resolvido
xml form_view Odoo12.0
Avatar
Avatar
2
mar. 20
7840
How to invisible field based on float time field value Resolvido
python xml invisible condition
Avatar
Avatar
1
mai. 22
3911
Custom Dashboard using js
Odoo12.0
Avatar
Avatar
1
abr. 25
4570
Enable Counters in odoo what is the use of it Resolvido
xml
Avatar
Avatar
1
mar. 25
2623
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