Odoo Help

1

Why doesn't views on ir.actions.act_window seem to work?

By
Kit Sunde
on 12/12/14, 5:09 AM 1,360 views

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?

 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 12/12/14, 5:09 AM
Seen: 1360 times
Last updated: 2/9/17, 8:26 AM