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

Im working on a extension for the res.partner model, so, now i'm trying to change the _rec_name because i've added a computed field who bring me more info than just the name of the partner.

It's possible to override the _rec_name of the res_parner, or i have to override an specific function from res_partner?



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

Hi

You just have to inherit the res.parther object and then add then field name in _rec_name property.

    class ResPartner(models.Model)
_inherit = 'res.partner'
_rec_name = 'your_field_name'

Hope this will solve your problem.

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

Sadly, isn't working I'm calling the records from another model so I think I have to modify the search_name function.

In that case you should override name_get() method that will do the job.

On Dec 11, 2017 7:33 PM, "Nicolás Mena" <nicolas.mena@uchile.cl> wrote:

Sadly, isn't working I'm calling the records from another model so I think I have to modify the search_name function.

--
Nicolás Mena


Sent by Odoo S.A. using Odoo.

ผู้เขียน

Thanks for the help, I'm now re-coding the name_get method

คำตอบที่ดีที่สุด

could you let me show how you re-coding name_get method I have same Issue

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo v11:Override Create Invoice แก้ไขแล้ว
1
ก.ย. 18
6393
2
ก.ค. 24
2602
1
มิ.ย. 24
5068
1
ต.ค. 23
10746
1
ต.ค. 23
98