跳至內容
選單
此問題已被標幟
2 回覆
16259 瀏覽次數

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')])
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 20
142
1
6月 19
4220
2
6月 18
89
0
3月 18
5832
3
5月 24
3695