XML : Many2one fields are not showing

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:

          <field name="name">Travel Request</field>            <field name="model">travel.request</field>            <field name="arch" type="xml">                <form string="Travel Request">                    <sheet>                     .                     .                     .                    <notebook colspan="4">                                              <page string="Trip Details">                            <field name="trip_details_ids" />                        </page>                        <page string="Reason">                            <field name="notes" nolabel="1" placeholder="Add a reason..." />                        </page>                                     </notebook>                </sheet>                </form>            </field>        </record>    

and here's my output view: screenshot

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?

No comments:

Post a Comment