Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
16333 Visualizzazioni

I'm trying to use search with 2 values like example:

result = self.env['hr.employee'].search([('marital', '=', 'single'), '&', ('gender', '=', 'male')])

But I only get error "ValueError: Invalid leaf &". How can I search with and?

Avatar
Abbandona
Risposta migliore

In you case, no need to put "&".

Odoo uses Polish Notation for Domain filters.

See this one for more details : https://stackoverflow.com/questions/45506255/odoo-multiple-condition-in-domain-error

Avatar
Abbandona
Risposta migliore
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 20
142
1
giu 19
4270
2
giu 18
89
0
mar 18
5881
3
mag 24
3747