콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
17389 화면

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)])

관련 게시물 답글 화면 활동
0
2월 25
18
0
5월 23
2780
2
9월 21
22267
2
12월 20
5513
6
9월 20
20056