Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
16145 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Melhor resposta
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
abr. 20
142
1
jun. 19
4147
2
jun. 18
89
0
mar. 18
5765
3
mai. 24
3600