【发布时间】:2018-01-13 00:22:59
【问题描述】:
我创建了一个与 Sell 有 One2many 关系的产品类:
class comp_product(models.Model):
_name = "comp.product"
_description = "Product Description"
name = fields.Char('Product Name')
description = fields.Text('add description of your product here')
sell_ids = fields.One2many('comp.sell', 'product_id', String = "Sells")
和 Sells 类:
class comp_sell(models.Model):
_name="comp.sell"
_description="Sells per Product"
name = fields.Float('How many units did you sell?')
date = fields.datetime.today()
product_id = fields.Many2one('comp.product', String = "Product", required = True)
在我看来,我添加了这段代码:
<notebook string="Other Informations">
<page string="Description"><field name="description" string="Description"/></page>
<page string="Update Sells">
<field name="sell_ids">
<tree string="Sells" editable="bottom">
<field name="name"/>
<field name="date" readonly="1" />
</tree>
</field>
</page>
</notebook>
看起来 odoo 无法识别树内的字段。我收到了这个错误:
ParseError: "Error while validating constraint
Field `date` does not exist
有人知道问题出在哪里吗? 谢谢。
【问题讨论】: