Odoo Help


many2one (dropdown) inside one2many (editable tree): Value display issue

on 2/10/15, 10:27 AM 828 views

Hello everyone, can someone please throw some light on the following issue:

I have got a requirement where I need to have a many2one field in a one2many (editable tree). I successfully managed to add the many2one field in the one2many editable tree. However the issue that I have at the moment is the value of the selected item in the drop down (i.e. many2one field) is displaying as hr.x.y, 1 and not the actual value.

KInd Regards

On 2/11/15, 6:12 AM

Issue Solved

That was silly me.

class x_y_z(osv.osv):
    _name = 'x.y.z'
    _description = 'xyz description'
    _columns = {
        'name': fields.char('abcd field name', required=True),

         'pqrs': fields.char('pqrs field name', required=True),

class e_f_g(osv.osv):
    _name = 'e.f.g'
    _description = 'efg description'
    _columns = {

x_y_z: fields.many2one(x.y.z, "xyz many2one")


here the field 'name' in x_y_z class is required to display the value properly, which i did not use initially and that was causing poblems


Thanks for correcting me ivan

on 2/11/15, 6:21 AM



| 5 3 6
Jakarta, Indonesia
On 2/11/15, 6:19 AM

Responding to @Narender's answer: No, column "name" is not mandatory, although it is helpful.  But, you do have to designate a column with different name to be the "name" column (which, if not specified will default to column "name").  You can specify it in the _rec_name = "x_y_z", for example in the class e_f_g().  Another way to override the behaviour is to override the name_get() method of the class.  Here you can even combine several column's content as the name.  The original behaviour (if "name" column does not exist and is not specified in _rec_name attribute and name_get() is not overridden) is to display model_name,database_id pair.

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: 2/10/15, 10:27 AM
Seen: 828 times
Last updated: 3/16/15, 8:10 AM