Odoo Help


Many2one fields are not showing

on 1/13/16, 7:27 AM 615 views


I'm trying to create a module to add extra fields to hr.holidays.

I've created a new menuitem called Travel Request to inherit hr.holidays and apply extra modification.

Here's my code:

class travel_request(models.Model):

_inherit = 'hr.holidays',

_name = 'travel.request'

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

trip_type = fields.Selection([('business_t','Business'),('personal_t','personal'),('sales_t', 'Sales')], 'Trip Type', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Please choose your desired trip type", 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)]})

trip_details_ids = fields.One2many('trip.details','travel_req_id', string="Trip Details")

class trip_details(models.Model):

_name = 'trip.details'

from_city = fields.Char('From')

to_city = fields.Char('To')

travel_req_id = fields.Many2one('travel.request', 'Travel Request')

and in my view.xml:

<record model="ir.ui.view" id="view_travel_request_form">

<field name="name">Travel Request</field>

<field name="model">travel.request</field>

<field name="arch" type="xml">

<form string="Travel Request">






<notebook colspan="4">

<page string="Trip Details">

<field name="trip_details_ids" />


<page string="Reason">

<field name="notes" nolabel="1" placeholder="Add a reason..." />







and here's my output view:


My problem is why the two char fields from_city & to_city are not showing as columns instead of the "Created by" row inside trip details?




| 4 4 6
Hyderabad, India

On 1/14/16, 12:58 AM


inspite of

<field name="trip_details_ids" />

try giving :

<field name="trip_details_ids">
         <field name="from_city"/>
         <field name="to_city"/>
         <field name="travel_req_id"/>

Hope it helps    

Thank you Pawan, it worked.. Looks like the way I used to create modules in openerp 7 isn't working anymore .. And I need to learn the new api

on 1/14/16, 2:23 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/13/16, 7:27 AM
Seen: 615 times
Last updated: 1/14/16, 2:21 AM