Skip to Content
Menu
This question has been flagged
3 Replies
10455 Views

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

Avatar
Discard
Best Answer

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


Avatar
Discard
Author

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?

Best Answer

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.

Avatar
Discard
Best Answer

Hi,

You can write like this,

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

Avatar
Discard