Reputation: 1289
I am trying to add a new field in the model of SaleOrderLine (Official Sale module).
It works perfect with the old API:
from openerp import _
from openerp.osv import osv, fields
class SaleOrderLineExt(osv.osv):
_inherit = ['sale.order.line']
_columns = {
'my_field_code': fields.float(string='My field Code'),
}
But, If I try to use the new API, the field is not created in the database.
from openerp import api, fields, models, _
class SaleOrderLineExt(models.Model):
_inherit = ['sale.order.line']
my_field_code = fields.Float(string='My field Code'),
I have read the Odoo new API guideline and it appears that my code is right, but it is not working.
What am I doing wrong?
Upvotes: 0
Views: 150
Reputation: 168
Just Remove the semicolon which is at the end of field. You code will definitely work.
Upvotes: 1
Reputation: 11143
Try with following code.
from openerp import api, fields, models, _
class SaleOrderLineExt(models.Model):
_inherit = 'sale.order.line'
my_field_code = fields.Float(string='My field Code')
Remove ,
at the end of field declaration.
Upvotes: 4