Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5350 Visualizzazioni

I have a view definition like: 

<record id="mrp_bom_form_action_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>

But it's not picking up the form. Instead I've had to do 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>

I don't understand why the first case doesn't work. According to the docs on act_window it should:

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 

What am I missing?

 

Avatar
Abbandona