Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
16425 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
Hi 
my be you need some update like this

result = self.env['hr.employee'].search(['&',('marital', '=', 'single'),('gender', '=', 'male')])
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 20
142
1
มิ.ย. 19
4334
2
มิ.ย. 18
89
0
มี.ค. 18
5970
3
พ.ค. 24
3811