Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

How to write Domain in Python

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
3 Antwoorden
24299 Weergaven
Avatar
Ajeng Shilvie

I want to define domain like this 

domain = A and B or C or (D and E)

name : fields.many2one('stock.production.lot,'No Engine',domain="[('branch_id','=',parent.branch_id),('tgl_penyerahan_bpkb','=',False),'|',('finco_id','=',parent.partner_id),('customer_id','=',parent.partner_id),('finco_id','=',False)]"),    

but it didn't show up , anyone can solve it ? Thanks in advance

0
Avatar
Annuleer
Avatar
Jordan Vrtanoski
Beste antwoord

The operators in the domain are prefix. Prefix notation requires the operators to be placed first and then the operands. This means that A and B should be translated in the prefix expression as and A B. Following this form, and based on you expression, this is the way to convert it to prefix and than writhe the domain:

A and B or C or (D and E) => and A B or C or (D and E) => or and A B C or (D and E) => or or and A B C (D and E) => or or and A B C and D E

So, the expression you need to write is or or and A B C and D E. There is convention that and can be omitted, so the final expression is:

or or A B C D E  which in code is ['|','|',('branch_id','=',parent.branch_id),('tgl_penyerahan_bpkb','=',False),('finco_id','=',parent.partner_id),('customer_id','=',parent.partner_id),('finco_id','=',False)]

I hope this helps. Prefix notation can be confusing for a first time, so here is a site that can help you understand the notation http://www.cs.man.ac.uk/~pjj/cs212/fix.html

3
Avatar
Annuleer
Ajeng Shilvie
Auteur

actually my real code is like this " A and B and C and D or E or (F and G) " , how can i implement it ? it so confuse .. thank you

Jordan Vrtanoski

A and B and C and D or E or (F and G) => or or and and and A B C D E and F G

Ajeng Shilvie
Auteur

ok i'll try it

Ajeng Shilvie
Auteur

domain="['|','|','&','&','&',('penerimaan_bpkb_id','!=',False),('state_stnk','=','proses_stnk'),('branch_id','=',parent.branch_id),('tgl_penyerahan_bpkb','=',False),('finco_id','=',parent.partner_id),'&',('customer_id','=',parent.partner_id),('finco_id','=',False)]", It still didn't work , the field filtering data even the customer_id is not what i select in parent menu ..

Jordan Vrtanoski

Check if your initial expression is correct. The A and B or C means (A and B) or C, so first A and B is evaluated. With other words, your expression can be read as (A and B and C and D) or (E) or (F and G), so if one of this three groups is true, the record will be presented.

Ajeng Shilvie
Auteur

yes Jordan , did i write the right code for it?

Ajeng Shilvie
Auteur

thanks for your answer ,,,

Avatar
Sea
Beste antwoord

  Following is the example to implement the domain = A and B or C or (D and E)

domain = ['|', '|', '&', ('branch_id','=',parent.branch_id), ('tgl_penyerahan_bpkb','=',False), ('finco_id','=',parent.partner_id),
                        '&', ('customer_id','=',parent.partner_id), ('finco_id','=',False)]

--->Hope this help you

1
Avatar
Annuleer
Avatar
Ajeng Shilvie
Auteur Beste antwoord

i write this , domain="['&','&','&',('penerimaan_bpkb_id','!=',False),('state_stnk','=','proses_stnk'),('branch_id','=',parent.branch_id),('tgl_penyerahan_bpkb','=',False),'|',('finco_id','=',parent.partner_id),'&',('customer_id','=',parent.partner_id),('finco_id','=',False)]" and it works ..

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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