Odoo Help


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.


Drop down is displaying literally name of model instead of fields.

Kapil More
on 5/14/15, 7:53 AM 542 views


I am creating one of the module for Hotel Management system.

The Class 'type_reservation' stores char values which should be displayed as drop down options.

I have taken a 'Many2one Relationship' and in the drop down but, instead of displaying fields of that module it is literally displaying the Name of corresponding module.

e.g. In many2one field 'type_id' instead of displaying values for types of reservation like Party, Buisness class, Individual, Group reservation etc.

It is displaying values like 'reservation,1','reservation,2','reservation,3', ..... and so on. 'reservation' is the name of the model which I have linked to many2one field.

Can someone plz help me get field names as drop down options.

Here is my code,


class product_template(osv.Model):



'is_a_room':fields.boolean("Is a Room?"),


class hotel_management(osv.Model):



'customer_name':fields.char('Name of Customer',size=64),


'credit_card':fields.char('Credit Card Number',size=64),

'check_in':fields.date("Check In Date"),

'check_out':fields.date("Check Out Date"),

'type_id':fields.many2one('reservation','Reserve many to one'),


class type_reservation(osv.Model):



'type_name':fields.char('Type of Reservation',size=64),



Jusab Sida (jsi)

--Jusab Sida (jsi)--
Tiny ERP Pvt Ltd
| 2 1 5
Gandhinagar, India
--Jusab Sida (jsi)--

Jusab Sida (jsi)
On 5/14/15, 8:11 AM

Hi Kapil,

Just put


in 'reservation' model.

Hope this will help you.


rename field "type_name" to "name".

value of field "name" is displayed in relational fields by default. if you want to use another field instead of default (name), then you've to set _rec_name to that fields name, as explained in the first option above.

Hey Jusab, It works ! Thanks for the solution.

Kapil More
on 5/15/15, 6:00 AM


Jusab Sida (jsi)
on 5/15/15, 6:15 AM

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)


Asked: 5/14/15, 7:53 AM
Seen: 542 times
Last updated: 6/8/15, 1:11 AM