Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2463 Lượt xem

is there a way to send more fields than just display_name and id from related model in odoov14?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello Mohammad Fallahi, 

Please find code in comment. 

I hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ

please try this

there are two ways:

first Way
def name_get(self):
result = []
for rec in self:
display_name = f"[{rec.field_name}] {rec.field_name}"
result.append((rec.id, display_name))
return result

second way
def name_get(self):
record = []
for record in self:
record.append((res.id, '%s - %s' % (res.field_name, field.field_name)))
return record

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 23
3832
1
thg 1 23
8608
1
thg 12 20
8158
1
thg 3 15
10577
2
thg 3 25
1274