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) ]
By default 'search' function takes 'AND' condition between 2 args. You can add 'OR' / 'AND' via '|' / '&' signs.
in faOtools' answer, I don't understand why he says its "Reverse Polish Notation, where the operators follow their operands", but then he goes on to show operands following the operators. Am I misunderstanding?
I believe it's actually just "Polish Notation" and not "Reverse Polish Notation" -- can anyone confirm? This point has been confusing me :)