Odoo Help

Welcome!

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.

0

How to use many2one to get value?

By
willie ho
on 10/20/14, 4:19 AM 527 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?

0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 10/20/14, 5:27 AM

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.

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 10/20/14, 7:35 AM

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.

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)

Stats

Asked: 10/20/14, 4:19 AM
Seen: 527 times
Last updated: 3/16/15, 8:10 AM