"Add an Element" -> "Field" -> "Reference" has the same help text than "Selection" but should work to get values from other model. Any hint how to use it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
Reference fields are used to add dynamic relations on a model. In normally used relational fields like Many2one, One2many & Many2many, we pre-define the related target model( comodel), so it allows only relation between those two models. But if we use the Reference field type, it allows the user to choose related model from a Selection list & then choose a related record on that selected model.
For example, you may refer the subcription module in Odoo 10, goto subscription>>models>>subscription.py , to check how reference field types are used.
And also you may refer the following link:
http://www.zbeanztech.com/blog/reference-fields-odoo
Hi ulrich,
i dont think you can provide a string to the selection value. _get_document_types in
subscription>>models>>subscription.py
returns a list of tuples.
make a funktion
def _get_krempel(self):
return [('MODEL1','NAME1'),(('MODEL2','NAME2'),(('MODEL3','NAME3')]
Hi, may I renew the question on how the the string has to look like which is written into the "Selection" field. In order words, how do the ('key','Label') pairs look like? Should the key represent the model and Label be just a string, such as [('model1','Name1'), ('model2', 'Name2'),....] and so on? Above answer does not really solve the issue.
Thank you in advance
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
4
thg 5 25
|
30925 | ||
|
0
thg 11 17
|
4931 | ||
|
2
thg 10 23
|
3782 | ||
|
0
thg 3 17
|
2441 | ||
|
2
thg 11 16
|
3871 |