Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
6657 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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šit
Nejlepší odpověď

Hi,

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

Thanks

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 25
463
1
úno 25
1232
0
zář 23
2175
2
čvn 23
3975
1
srp 22
12727