user1627788
user1627788

Reputation:

How to set a new search filter?

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.

Upvotes: 3

Views: 963

Answers (1)

user1627788
user1627788

Reputation:

I got this solution on another site 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}

Upvotes: 2

Related Questions