Say I have this:
<record id="mrp_bom_form_action_master_products" model="ir.actions.act_window">
<field name="name">Master Bill of Materials</field>
<field name="res_model">mrp.bom</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/>
<field name="views" eval="[(False, 'tree'), (ref('mrp_bom_form_view_master'), 'form')]"/>
<field name="search_view_id" ref="mrp.view_mrp_bom_filter"/>
</record>
According to the docs:
views
a list of (view_id, view_type) pairs. The second element of each pair is the category of the view (tree, form, graph, ...) and the first is an optional database id (or False). If no id is provided, the client should fetch the default view of the specified type for the requested model (this is automatically done by fields_view_get()). The first type of the list is the default view type and will be open by default when the action is executed. Each view type should be present at most once in the list
But it doesn't work. Instead I've done this:
<record model="ir.actions.act_window.view"
id="mrp_bom_form_view_master_form">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="mrp_bom_form_action_master_products"/>
</record>
<record model="ir.actions.act_window.view"
id="mrp_bom_form_view_master_tree">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="mrp_bom_form_view_master"/>
<field name="act_window_id" ref="mrp_bom_form_action_master_products"/>
</record>
Which works, but I don't understand why the first case doesn't.