Skip to Content
Menú
This question has been flagged
2 Respostes
16364 Vistes

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
Descartar
Best Answer

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
Descartar
Best Answer
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’abr. 20
142
1
de juny 19
4287
2
de juny 18
89
0
de març 18
5912
3
de maig 24
3768