Skip to Content
Menu
This question has been flagged
2 Replies
16348 Rodiniai

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?

Portretas
Atmesti
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

Portretas
Atmesti
Best Answer
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
bal. 20
142
1
birž. 19
4278
2
birž. 18
89
0
kov. 18
5891
3
geg. 24
3760