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

How I can programmaticaly set default custom search filter in "Projects" app in kanban view?            

아바타
취소
베스트 답변

Activate the developer mode and go to the list view where you want to apply the default filter. by pressing the debug button in the top right corner of the screen click on the option which says 'Edit search view'  

let us take a take the quotations list view page in which you can see an example of your scenario.
you will be able to see the search view definition if you have followed my above steps, you can see a line which looks like the following in the search view definition
<filter string="My Quotations" name="my_quotation" domain="[('user_id', '=', uid)]"/>​

this line defines a filter and the end goal is to apply this filter in the action so that every this list view is opened, this action filter is automatically applied. keep in mind the part name='my_quotation' now close the search view popup and click again the debug button and click open the menu which says Edit Action. in the popup that opens up, look at the field which says Context value you will see a line like {'search_default_my_quotation': 1} . this is the syntax for applying an existing filter in an action. if you want to apply another filter(assuming it is previously defined like <filter string="Quotations" name="draft" domain="[('state','in',('draft', 'sent'))]"/>) .
Lets say for example you have created a filter called draft and you want to apply this in the action of the same list view, the Context value in the action will become {'search_default_my_quotation': 1, 'search_default_draft': 1} 

The result will be both these filters getting applied in the action.

아바타
취소
베스트 답변

Hi,

Have a look at this video: How To Set Default Filter For View in Odoo12

Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
7월 25
463
Search a message 해결 완료
1
2월 25
1232
0
9월 23
2173
2
6월 23
3971
1
8월 22
12726