Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

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

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
xmlconditionOdoo12.0
1 Antworten
16383 Ansichten
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
Verwerfen
Avatar
Anoop Menon
Beste Antwort

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

Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Working with xml and xsd... how to? Gelöst
xml xsd Odoo12.0
Avatar
Avatar
1
Aug. 20
6320
Declare a field, get its value but not save it on database Gelöst
xml form_view Odoo12.0
Avatar
Avatar
2
März 20
7829
How to invisible field based on float time field value Gelöst
python xml invisible condition
Avatar
Avatar
1
Mai 22
3908
Custom Dashboard using js
Odoo12.0
Avatar
Avatar
1
Apr. 25
4565
Enable Counters in odoo what is the use of it Gelöst
xml
Avatar
Avatar
1
März 25
2621
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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