This question has been flagged
3 Replies
5607 Views

So, i bored each time configure views by hands in odoo and decided to create module that contains all changes.

When i go to contacts app, I need tree view load by default.

So how this done? What I supose to put in views.xml?

Avatar
Discard
Best Answer

Hello,

You need to update view_mode in action and sequence of view in action.
You can write as following in your custom module to update it.

<record id="contacts.action_contacts" model="ir.actions.act_window">
	<field name="view_mode">tree,form,kanban</field>
</record>
<record id="contacts.action_contacts_view_kanban" model="ir.actions.act_window.view">
	<field name="sequence" eval="4"/>
	<field name="view_mode">kanban</field>
	<field name="view_id" ref="base.res_partner_kanban_view"/>
	<field name="act_window_id" ref="contacts.action_contacts"/>
</record>

Thanks,

Avatar
Discard
Best Answer

You have to inherit windows action like this ... but for me this doesn't work either ...

<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