如何在Odoo的product.supplierinfo.tree.view上显示产品类别名称?

时间:2018-03-07 14:57:01

标签: python odoo odoo-view odoo-11

我想在Odoo上的product.supplierinfo.tree.view中显示相关的产品类别名称?

以下是供应商价格清单捕获

1 个答案:

答案 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>