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

Hello everybody,

I am on Odoo 10, and I'd like to use multi condition on domain  in xml.

This is the domain that I want to write:

(A and B) Or ( C and D).

How can I do it ?

Thanks.

Best regards

形象
丢弃
最佳答案

Hi , 

Try This 

AND

<field ... domain="[('field_name', '=', id), ('field_name', '=', id) ]" />

OR:

<field ... domain="['|',('field_name', '=', id), ('field_name', '=', id) ]" />


look this 

https://www.odoo.com/fr_FR/forum/aide-1/question/how-to-set-this-specific-domain-in-xml-83173


形象
丢弃
编写者

I want to write like this:

['|',(('field_name','=',value),('field_name1','!=',False)),(('field_name1','=',value),('field_name','!=',False))]

Can you provide us with the code so that I can help you?

最佳答案

Hi,

If you do not use "|"(pipe sign) then it will apply and condition.

if you use "|" (pipe sign) then it will apply or condition.

Please check my code:

OR condition domain="['|', ('field1', 'operator', value), ('field2', 'operator', value)]"

AND condition domain="[('field1', 'operator', value), ('field2', 'operator', value)]"
Hope above will help you.

形象
丢弃
最佳答案

Hi,

You can write like this,

[ OR,  AND,  A,  B,   AND,  C,  D ]

形象
丢弃