[英]Installing module in Odoo 8
So I've recently transitioned from version 7 to 8. Was just trying to create a basic module with the new api and kept getting the same error regardless any changes I made. 因此,我最近从版本7过渡到了版本8。我只是尝试使用新的api创建一个基本模块,并且不管我做任何更改,都不断遇到相同的错误。
I have this: 我有这个:
from openerp import models, fields
class IncomingDeliveryFollowup(models.Model):
_name = 'xx.incoming.delivery.followup'
_columns = {
'xx_price_unit': fields.Float(string='Unit Price', required=True),
}
And I keep getting: 而且我不断得到:
AttributeError: to_field
You can't use 你不能用
_columns = {
'xx_price_unit': fields.Float(string='Unit Price', required=True),
}
Instead use 改为使用
xx_price_unit = fields.Float(string='Unit Price', required=True)
Since you are using models.Model
of the new Odoo API, you should define your model as follows 由于您使用的是新Odoo API的
models.Model
,因此应按以下方式定义模型
from openerp import models, fields
class IncomingDeliveryFollowup(models.Model):
_name = 'xx.incoming.delivery.followup'
xx_price_unit = fields.Float(string='Unit Price', required=True)
Reference: 参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.