我无法弄清楚如何定义在OpenERP树视图中单击行时发生的操作。我已经创建了一个自定义树视图来显示产品供应商(product.supplierinfo)。理想情况下,我想打开product.product对象的表单视图,其中Suppliers选项卡处于活动状态,而不是product.supplierinfo对象的视图(就像现在一样)。这可能吗?至少我想打开一个弹出窗口,其中包含supplierinfo的视图,其中包含指向父产品的链接。
供应商信息视图(default_code,manuf_name和manuf_code都是添加到product.supplierinfo模型的自定义字段):
<record id="product_suppliers_tree_view" model="ir.ui.view">
<field name="name">product.suppliers.tree.view</field>
<field name="model">product.supplierinfo</field>
<field name="type">tree</field>
<field name="priority">16</field>
<field name="arch" type="xml">
<tree string="Product Suppliers">
<field name="default_code"/>
<field name="product_id"/>
<field name="name"/>
<field name="product_code"/>
<field name="manuf_name"/>
<field name="manuf_code"/>
</tree>
</field>
</record>
供应商信息行动:
<record id="product_suppliers_action" model="ir.actions.act_window">
<field name="name">Product Suppliers</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.supplierinfo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="product_suppliers_tree_view"/>
<field name="help">Here you can search for products by supplier information, including supplier and manufacturer name and part number. Each product can have one or more supplier sources.</field>
</record>