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

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!

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

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

อวตาร
ละทิ้ง
ผู้เขียน

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
get the value of a field of other model แก้ไขแล้ว
3
มี.ค. 24
7149
2
ก.พ. 24
2366
2
ก.พ. 25
5975
1
ธ.ค. 24
1500
4
พ.ค. 24
12835