跳至内容
菜单
此问题已终结
1 回复
5063 查看

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?



形象
丢弃

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

编写者 最佳答案

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

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

 

形象
丢弃
相关帖文 回复 查看 活动
4
7月 18
3366
5
8月 24
46780
2
4月 24
2608
3
6月 23
5943
2
6月 23
4812