This question has been flagged

Hi I'm trying to add default filter to Contact app.

What I'm trying to do is below

<record id="eric_default_contact_filter" model="ir.actions.act_window">

<field name="name">Public Contact</field>

<field name="res_model">res.partner</field>

<field name="view_type">form</field>

<field name="view_mode">kanban,tree,form</field>

<field name="context">{'search_default_filter_public_contact':1}</field>

<field name="search_view_id" ref="base.action_partner_form"/>

<field name="help" type="html">

<p><b>No module found!</b></p>

<p>You should try others search criteria.</p>

</field>

</record>


But After spending hours, default filter button doesn't show up in the search block.


Please let me know

Avatar
Discard
Best Answer

I think You can achieve the same by, copying the original record into the custom module and change its id to "module_name.original_id" and add desired filter into it

Avatar
Discard
Author

Alright, I will do what you said. Thanks

Best Answer

You have to inherit the windows action. See my code ...

<record id="contacts.action_contacts" model="ir.actions.act_window">
        <field name="name">Contacts</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="view_type">form</field>
        <field name="view_id" ref="base.view_partner_tree"/>
        <field name="context">{'search_default_filter_public_contact':1}</field>
    </record>

Avatar
Discard