Skip to Content
Menu
This question has been flagged
1 Reply
2919 Views

Hello,

I'm trying to create a new module that inherits hr.holidays so I can add new fields

Here's my code:

class travel_request(models.Model):

_inherit = 'hr.holidays',

_name = 'travel.request'

_columns = {

'flight_class': fields.Selection([('add','Business class'),('add','Economy class')], 'Flight Class', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Please choose your flight class", select=True),

'city_from': fields.Char('From', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),

'city_to': fields.Char('To', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),

}

and when I try to start the server I got this error

CRITICAL travel-management openerp.modules.module: to_field

What is wrong with my code?

Avatar
Discard
Best Answer

Please add the code as like below.

from openerp import models, fields, api, _

class travel_request(models.Model):

_inherit = 'hr.holidays',

_name = 'travel.request'

flight_class = fields.Selection([('add','Business class'),('add','Economy class')], 'Flight Class', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Please choose your flight class", select=True)

city_from = fields.Char('From', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]})

city_to = fields.Char('To', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]})


It will for fine.

Avatar
Discard
Related Posts Replies Views Activity
1
Apr 17
2478
0
Jul 19
497
0
Jul 19
848
1
Jul 19
585
1
May 16
5586