Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
filterdomainv7
1 Atsakyti
14783 Rodiniai
Portretas
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
Portretas
Atmesti
Portretas
Temur
Best Answer

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
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
How can i use a field function in the domain filter? Solved
filter domain v7
Portretas
Portretas
Portretas
Portretas
3
kov. 15
21153
Filter meetings where I'm an attendee
filter domain v7 meeting
Portretas
Portretas
Portretas
Portretas
3
liep. 20
8717
Filtering messages not working
filter domain v7 messages
Portretas
0
kov. 15
4574
How to use AND / OR operators in advanced filters? Solved
filter v7
Portretas
Portretas
Portretas
Portretas
3
bal. 23
34935
Filter many2one field with functional field
filter domain
Portretas
Portretas
Portretas
5
rugs. 20
13477
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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