Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

Set default filter value in search view

By
Tajjajt
on 3/13/13, 9:09 AM 16,461 views

Hello !

how can I set default value to my filter button in search view? I try to set a context to the action like the way it is in partner module but no result :

<field name="context">{'default_customer':0, 'search_default_supplier': 1, 'default_supplier':1}</field>
8

Parth Gajjar

--Parth Gajjar--
1484
| 3 3 5
Ahmadabad, India
--Parth Gajjar--
Parth Gajjar
On 3/13/13, 9:52 AM

You can use only those fields which are defined in search view.

For this you need to pass proper key and value in context.key should like this

search_default_filter_name

Example: In res_partner search view there is one filter like this

<filter string="Persons" name="type_person" icon="terp-personal" domain="[('is_company','=',0)]"/>

If you want this filter as default pass context like this

<field name="context">{"search_default_customer":1,"search_default_type_person":1}</field>

If you don't want search_default_customer use {"search_default_type_person":1} instate of passing like this {"search_default_customer":0,"search_default_type_person":1}

You can also use field from search view

<field name="parent_id" filter_domain="[('parent_id','child_of',[self])]"/>

for use field pass context like this {"search_default_parent_id":1}

hope this will help

How can i Set default filter on company of logged-in user in search view for any object..? because user_id.company_id.id is not working for me.

Vinod Singh
on 8/8/13, 9:29 AM

this is a question related to default search views. Suppose i need to dynamically enable or disable a filter how could i do? I tried this but it's not working: {'search_default_not_closed':1, 'search_default_lancement':[('defaultLancement','=', True)]} Thanks

Atakem
on 5/30/16, 7:46 AM
1
Vinod Singh
On 8/1/13, 11:56 AM

How can i Set default filter on company of logged-in user in search view for any object..? because user_id.company_id.id is not working for me.

Hi, I have this issue too. How can i set default filter for Customers as per their logged in company ?!

Karolin Ar.
on 8/25/14, 2:45 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 3/13/13, 9:09 AM
Seen: 16461 times
Last updated: 8/6/15, 3:16 AM