Hello,
is there a way to show another field instead of rec name in many2one field without changing the rec name?
i mean to keep the rec_name as it is but show another field in a specific form?
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
is there a way to show another field instead of rec name in many2one field without changing the rec name?
i mean to keep the rec_name as it is but show another field in a specific form?
Thanks
To display another field in specific form only you need to add context to xml of the Many2One field Then you will override name_get method in the model of Many2one field as below
def name_get(self):
if context is None:
context = {}
res = []
if context.get('special_display_name', False):
for record in self:
res.append(record.id, rec.YOurFieldYouWantToShow)
else:
for record in self:
res.append(record.id, record.name)
return res
please check the below links for
XML field:
<field name="Many2oneField" context="{'special_display_name': True}"/>
Hi,
Try use use name_get method for this
For more reference check the following blog.
https://www.cybrosys.com/blog/how-to-use-of-name-get-function-in-odoo
Regards
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 | |
|---|---|---|---|---|
|
3
thg 10 20
|
6246 | |||
|
3
thg 9 25
|
2478 | |||
|
2
thg 4 25
|
7915 | |||
|
2
thg 2 25
|
7127 | |||
|
2
thg 6 24
|
6330 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.