Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
16264 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Apr 20
142
1
Jun 19
4222
2
Jun 18
89
0
Mar 18
5833
3
Mei 24
3695