Skip to Content
Menu
This question has been flagged
3 Replies
6963 Zobrazenia

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

Avatar
Zrušiť
Best Answer

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.

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
júl 25
1088
1
feb 25
1593
0
sep 23
2560
2
jún 23
4576
1
aug 22
13277