当某个关系域所指对象有多个视图表示时,如果需要显示某个特定视图,可以通过context中的tree_view_ref和form_view_ref变量指定。举例:
'applications': fields.one2many('device.application', 'device_id', 'Application'),
<record model="ir.ui.view" id="view_application_tree">
<field name="name">application</field>
<field name="model">device.application</field>
<field name="arch" type="xml">
<tree string="Application">
<field name="name"/>
</tree>
</field>
</record><record model="ir.ui.view" id="view_application_form">
<field name="name">application</field>
<field name="model">device.application</field>
<field name="arch" type="xml">
<form string="Application">
<field name="name"/>
<field name="description"/>
</form>
</field>
</record><field name="applications" context="{'tree_view_ref':'view_application_tree','form_view_ref':'view_application_form'}" />
本文探讨了在关系域中使用不同视图表示同一对象的方法,并通过实例展示了如何利用context中的tree_view_ref和form_view_ref变量来指定特定视图。详细介绍了view_application_tree和view_application_form两个视图的XML架构,以及如何将这些视图应用于应用程序列表的显示。

2万+

被折叠的 条评论
为什么被折叠?



