Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
16278 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 20
142
1
cze 19
4235
2
cze 18
89
0
mar 18
5839
3
maj 24
3700