Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to write a Domain in a filter? [SOLVED]

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
filterdomainv7
1 Răspunde
14782 Vizualizări
Imagine profil
Yannick Gerard

Hello, I know my question seems kinda dumb (there is an attribute "domain" so what's the point ?) but here's my problem:

I created a default filter:

<filter string="My Validations" icon="terp-personal" name="my_validations"
domain="['|',('employee_id.parent_id.user_id','=', uid),'&amp;',('employee_id.coach_id.user_id','=',uid),('state', '=', 'validate1')]"
help="My validations"/>

with this domain, I have no problem, but it's not exactly what I want ... i want to add an other constraint: state = confirm so I tried many things and nothing worked (in order to have something like ( employee.parent AND state confirm) OR (employee.coach AND state validate1)

domain="['&amp;',('employee_id.parent_id.user_id','=', uid),'|',('state','=','confirm'),'&amp;',('employee_id.coach_id.user_id','=',uid),('state', '=', 'validate1')]" 

This one works, but only for the first part (employee.parent and confirm), the second one is not seen.


domain="['|',('&amp;',('employee_id.parent_id.user_id','=', uid),('state','=','confirm')),('&amp;',('employee_id.coach_id.user_id','=',uid),('state', '=', 'validate1'))]"  

This one throw an error " Invalid leaf ['&', ['employee_id.parent_id.user_id', '=', 316], ['state', '=', 'confirm']]"


domain="['|',['&amp;',('employee_id.parent_id.user_id','=', uid),('state','=','confirm')],['&amp;',('employee_id.coach_id.user_id','=',uid),('state', '=', 'validate1')]]"   

And this one throw an error "TypeError:results.groupby is undefined"

And I'm lost ... I don't know what to try now ...

Please ... Help ç_ç


0
Imagine profil
Abandonează
Imagine profil
Temur
Cel mai bun răspuns

a problem is that you're trying to use wrong notation, you've to write odoo domains using prefix notation.

The main advantage of prefixed/postfixed operators are to avoid to use brackets for determine a sequence of calculation. in these domains there is used prefixed notation, so each operator takes it's following operands. there is no need to use extra brackets.

I'll take fseudocode from your question and transform it step by step:

you wrote

in order to have something like ( employee.parent AND state confirm) OR (employee.coach AND state validate1)

(BTW you've written above statement using infix notation, in order to get worked it in odoo domains, we've to transform it into the prefix notation)

first transform statements in the brackets, move AND condition to the start of each of them:

(AND, employee.parent , state confirm) OR ( AND, employee.coach , state validate1) 

-here AND takes it's two following arguments, then it's caclulated and considered as argument for OR.  (same for another AND), now move the OR operator to the left of it's arguments:

OR, (AND, employee.parent , state confirm),( AND, employee.coach , state validate1)

but here brackets are extra, they can't determine anything in rapport of sequence of calculation, each AND takes it's following two operands(as binary operator), and OR takes it's following two operands as well (results of two AND). so now we remove brackets, and your fseudo statement will become something as:

OR, AND, employee.parent , state confirm, AND, employee.coach , state validate1

-it's prefix notation equivalent of your infix notation fseudostatement.

of course you'll have some other brackets in real domain statement, but not the ones used for sequence/prioritize calculations.

you'll have something like:

domain="['|','&amp;',('employee_id.parent_id.user_id','=', uid),('state','=','confirm'),'&amp;',('employee_id.coach_id.user_id','=',uid),('state', '=', 'validate1')]" 

2
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How can i use a field function in the domain filter? Rezolvat
filter domain v7
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
mar. 15
21153
Filter meetings where I'm an attendee
filter domain v7 meeting
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
iul. 20
8717
Filtering messages not working
filter domain v7 messages
Imagine profil
0
mar. 15
4574
How to use AND / OR operators in advanced filters? Rezolvat
filter v7
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
apr. 23
34934
Filter many2one field with functional field
filter domain
Imagine profil
Imagine profil
Imagine profil
5
sept. 20
13477
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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