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
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Sep 23
|
1026 | ||
|
2
Jun 23
|
2472 | ||
|
1
Aug 22
|
10777 | ||
Chatter in models
Solved
|
|
1
Mar 22
|
1502 | |
|
2
Jan 21
|
3170 |