简体   繁体   中英

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.

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

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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM