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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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
My method for simplification:
(1) Start with the outermost operator and move it to the start of the expression.
"(A operator B)" becomes "operator (A B)"
(2) Repeat step 1 for each sub expression with an operator to move.
"A operator (B operator C)" becomes "operator A (B operator C)" then "operator A (operator B C)"
(3) Remove all brackets.
"A operator (B operator C)" becomes "operator A operator B C"
So for my example:
( A or B ) AND ( C or D or E )
First simplification:
AND ( A or B ) ( C or D or E )
left side
AND ( or A B ) ( C or D or E )
right side outer
AND ( or A B ) ( or C ( D or E ) )
right side inner
AND ( or A B ) ( or C ( or D E ) )
remove brackets
AND or A B or C or D E
In Odoo domain syntax this would be:
[ '&', '|', (A), (B), '|', (C), '|', (D), (E) ]
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.
Create an account today to enjoy exclusive features and engage with our awesome community!
Реєстрація
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.