Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

CRITICAL travel-management openerp.modules.module: to_field

By
youta
on 1/12/16, 5:00 AM 352 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?

1
Nilesh Sheliya
On 1/12/16, 5:38 AM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/12/16, 5:00 AM
Seen: 352 times
Last updated: 1/13/16, 1:07 AM