跳至内容
菜单
此问题已终结
2 回复
16260 查看

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