Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3488 มุมมอง

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?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง