This question has been flagged
2 Replies
2697 Views

I am creating a module and I want to use many2one field to many a selection field.

How can I control whcih column to get from other table?

Avatar
Discard
Best Answer

I think this piece of documentation will clear up a lot for you:

https://doc.odoo.com/trunk/server/03_module_dev_02/#relational-types

[EDIT]

If you only want specific data from the other object, add a domain to the field.

Avatar
Discard
Best Answer

Willie, if I understand you correctly you want to understand where the Value that is used for many2one field is taken from.

Technically it is taken from an ORM method called _name_get which will return a list of tuple pairs containing the database ID and the value to display.  Now, if you don't change anything on the _name_get method, the default is that it will display whatever is in the column named "name" or (if any) column specified in the _rec_name attribute of the ORM.

Hope this help.

Avatar
Discard