Odoo Help

Welcome!

This community 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.

0

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

By
Kit Sunde
on 12/12/14, 5:09 AM 1,072 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?

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/12/14, 5:09 AM
Seen: 1072 times
Last updated: 3/16/15, 8:10 AM