Skip to Content
Menu
This question has been flagged
1 Reply
3967 Views

In Odoo 11 my views are not being found based on (model, type). 

For views 

<record model="ir.ui.view" id="payer_list_view">
<field name="name">tidb.payer.list</field>
<field name="model">tidb.payer</field>
<field name="arch" type="xml">
<tree>
<field name="display_name"/>
<field name="phone"/>
<field name="email"/>
<field name="contact_address"/>
</tree>
</field>
</record>

and 

<record model="ir.ui.view" id="payer_form">
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="name">tidb.payer.form</field>
<field name="model">tidb.payer</field>
<field name="groups_id" eval="[(4,ref('group_clinical'))]"/>
<field name="arch" type="xml">
<field name="vat" position="replace">
<field name="customer" invisible="1"/>
<field name="supplier" invisible="1"/>
<field name="vat" string="Tax ID"/>
</field>
</field>
</record>

which are the only views defined for that model. 

I can get them to be used if I define my window action as 

<record model="ir.actions.act_window" id="payer_action_window">
<field name="name">Payers</field>
<field name="res_model">tidb.payer</field>
<field name="view_mode">list,form</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('payer_list_view')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('payer_form')})]"/>

</record>

then the views work perfectly. If I omit the "view_ids" field then the views are not resolved by the (model, type) search described in the documentation.  

Can anyone see what I'm doing wrong here? Shouldn't the views be found w/o explicitly specifying them?



Avatar
Discard

Model and Views in Odoo: https://goo.gl/pZpTVu

Author Best Answer

The problem was that the mode of the view was not set to primary

       <field name="mode">primary</field>

 

Avatar
Discard
Related Posts Replies Views Activity
4
Jul 18
2510
5
Aug 24
42968
2
Apr 24
948
3
Jun 23
3119
2
Jun 23
2358