Community mailing list archives

Many2One in Odoo v9 community

- 10/06/2016 09:55:30

Hi, I'm on Odoo v9 community

I just want to know how to show a Char field as a Many2one in v9, since it has changed a little.

So, I have this model:

class mymodel(models.Model):
    _name = 'mymodel'

    field_ = fields.Char(string="This is a field")

And then I load this into, let's say account.invoice model:

class account_invoice(models.Model):
    _inherit = "account.invoice"

    relation = fields.Many2one(comodel_name="mymodel", string="That other field")

If I do this, the relation is there, and it shows the field, BUT; it is not showing the actual content of the field, just and id like: mymodel,1

How can I fix this to actually show the Char field content?

Thanks in advance!
Kristian Koci
Linux User #582221