Odoo 树视图中的2个字段

Odoo 树视图中的2个字段,odoo,odoo-8,odoo-9,Odoo,Odoo 8,Odoo 9,在产品类别中,我添加了一个product\u id字段,我想用一个树状视图来显示产品的名称和默认代码。由于某种原因,我得到了错误“字段默认值\u代码不存在” product.category.inherit.qty.discount.Config Hetlita 产品类别 形式 类别ProductCategory(models.Model): _继承='product.category' 折扣数量=fields.Float(string='折扣数量') product_id=fields.M

在产品类别中,我添加了一个
product\u id
字段,我想用一个树状视图来显示产品的名称和默认代码。由于某种原因,我得到了错误“字段
默认值\u代码
不存在”


product.category.inherit.qty.discount.Config Hetlita
产品类别
形式
类别ProductCategory(models.Model):
_继承='product.category'
折扣数量=fields.Float(string='折扣数量')
product_id=fields.Many2many(
'product.template',string='Products')

这是因为在model
product.template
上没有默认代码,而是在model
product.product
的变体上。我会将
product.category
上的字段更改为
product.product
上的One2Many:

product_id=fields.One2many(
comodel_name='product.product',
逆\u name='categ\u id',
string='Products')
您的xml中有一个错误:


xml中有一个错误,必须将树放入字段节点中