Community mailing list archives

community@mail.odoo.com

Re: Many2One in Odoo v9 community

by
kristian
- 10/06/2016 10:37:54
Grover

Excellent

Thank You very much

On Thu, Oct 6, 2016 at 10:03 AM, Grover Menacho <hmen@live.co.uk> wrote:

You need to set your _rec_name, choose a column to act as name if you don't have that field on the comodel.


_name = 'comodel.object'

_rec_name = 'column_name'


Other option to create complex names is name_get


def name_get(self)



Grover Menacho Q.
GH Mediacloud



De: Kristian Koci <kristian.koci@gmail.com>
Enviado: jueves, 06 de octubre de 2016 09:58 a.m.
Para: Community
Asunto: Many2One in Odoo v9 community
 

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
Public repository: https://github.com/kkoci
kkoci has 60 repositories available. Follow their code on GitHub.




_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Kristian Koci
Linux User #582221