コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
16314 ビュー

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
4253
2
6月 18
89
0
3月 18
5870
3
5月 24
3723