我想在Odoo上的product.supplierinfo.tree.view
中显示相关的产品类别名称?
以下是供应商价格清单捕获:
答案 0 :(得分:2)
只需创建一个related field:
product_category = fields.Many2one(
string='Product Category',
related='product_tmpl_id.category_id',
comodel_name='product.category',
)
像往常一样将它添加到树视图中:
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
<field name="name">product.supplierinfo.tree.view</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="product_category" />
</field>
</field>
</record>