I created a module with normal settings which shows a form view and a tree view. The default behavior is to show the form view at first. I need to change this and show the tree view as the default view.
I tried to use the sequence attribute and changed the values with different values but it didn't solve the problem
<field name="sequence" >1</field>
Also, I tried to change the order in the view_mode
attribute:
<field name="view_mode" >tree,form</field>
First We Need to change the Order of the ir.actions.act_window and see Below
Sample Demo for the customer(partner)
<record id="base.action_partner_form" model="ir.actions.act_window">
<field name="name">Customers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban</field>
<field name="domain">[('customer','=',1)]</field>
<field name="context">{'default_customer':1, 'search_default_customer':1}</field>
<field name="search_view_id" ref="base.view_res_partner_filter"/>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
OpenERP helps you easily track all activities related to
a customer: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
Also change the sequence of view something like this
<record id="base.action_partner_tree_view1" model="ir.actions.act_window.view">
<field name="sequence" eval="0"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="base.view_partner_tree"/>
<field name="act_window_id" ref="base.action_partner_form"/>
</record>
<record id="base.action_partner_form_view2" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="base.view_partner_form"/>
<field name="act_window_id" ref="base.action_partner_form"/>
</record>
<record id="base.action_partner_form_view1" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">kanban</field>
<field name="view_id" ref="base.res_partner_kanban_view"/>
<field name="act_window_id" ref="base.action_partner_form"/>
</record>
Above code working well in my side.
I hope this should helpful for you .. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With