Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3769 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 17
3216
0
čvc 19
497
0
čvc 19
848
1
čvc 19
585
1
kvě 16
6503