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

In the field many2one, when I finish creating data in popup Create and Edit. . .Then the name will be displayed in the default field many2one. I want it to show partner_name. What do I have to do? I tried setting _rec_name = "partner_name" but it not working. Thanks a lot!

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

Hi,

You might have to inherit and change the name_get function of the res.partner model.

See: https://www.youtube.com/watch?v=aT_tsfW5HaQ

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Niyas Raphy, Thanks for your answer! But I tried to inherit name_get function.
My code:
def name_get(self):
result = []
for record in self:
result.append((record.id, '%s' % record.partner_name))
return result

It was showing properly.
But I want to say, at the end of creating new data in the popup Create and Edit...
It displays the name, not partner_name.

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 24
7116
2
thg 2 24
2302
2
thg 2 25
5948
1
thg 12 24
1484
4
thg 5 24
12752