How I can programmaticaly set default custom search filter in "Projects" app in kanban view?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
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.
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
lip 25
|
171 | ||
Search a message
Rozwiązane
|
|
1
lut 25
|
1064 | |
|
0
wrz 23
|
2070 | ||
|
2
cze 23
|
3800 | ||
|
1
sie 22
|
12529 |