i want to set multiple (&) and (|) in single search method.
i have these Many2many field-
self.env.[sale.order].search(
(saleorders ID in m2m OR all ID) AND (customers ID in m2m OR all ID) AND (salespersons in m2m OR all ID)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
i want to set multiple (&) and (|) in single search method.
i have these Many2many field-
self.env.[sale.order].search(
(saleorders ID in m2m OR all ID) AND (customers ID in m2m OR all ID) AND (salespersons in m2m OR all ID)
Hello
I will link you to an existing answer which breaks down the process nicely:
https://www.odoo.com/en_US/forum/help-1/question/domain-notation-using-multiple-and-nested-and-2170
Essentially, you want to solve the order by abstracting the search logic and then re-adding your details afterwards.
I think (I have not tested) your search would break down to:
AND AND OR A B OR C D OR E F
Once I substitute your values back in, you would be left with:
'&', '&', '|', (saleorders ID in m2m), (all ID), '|', (customers ID in m2m), (all ID), '|', (salespersons in m2m), (all ID)
Again, I'm not certain that logic will work, but you should be able to come close with the process described in the link above.
Good luck!
Hello Travis,
actually, i have problem like this.
all r M2M and search in sale_order with IN condition.
search( [( A & B & C & D) or (A & B & C) or (A & B) or (A) or (B) or (C) or (D)])
how to set conditions like above . please give me any solution.
In that case, check the answer here about complex domain with many2many fields: https://www.odoo.com/forum/help-1/question/complex-many2many-domains-in-views-41777#answer_41784
However, for the search you commented, I think you should be able to simplify it a lot (assuming there are only 4 variables total).
It would be able to break down to: search([A OR B OR C OR D])
In Polish Notation: search(['|', '|', '|', (A), (B), (C), (D)])
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
May 23
|
1396 | ||
|
2
Sep 21
|
20030 | ||
|
2
Dec 20
|
3931 | ||
|
6
Sep 20
|
18932 | ||
DBFilter www or domain
Solved
|
|
2
May 17
|
7786 |