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

Hello, I have Odoo8.

I have a view of a specified model by: <field name="model">sale.order</field> for example.

If I want to display in that view values from other model related with this, for example the display_name of the partner_id, how can I do? If I do this <field name="partner_id.display_name" /> (in the "arch" field, of course) I get an internal server error when install the module.

Thanks!

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

@Ivan, this works in Odoo8? I don't find any reference in the docs and I do this related_display = fields.related('partner_id', 'display_name') and not works.

Hola Jose, lograste mostrar un campo de otro modelo en una vista?? Porque estoy con el mismo problema y no encuentro solucion

ผู้เขียน

Hola, pude hacerlo con las respuestas que me indicaron abajo. ¿Vos no pudiste?

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

Hello José,

You can define related field for this as below:

display_name = fields.Char('Display Name', related='partner_id.display_name',store=True)

Thanks!

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

@Jose, you need to create a related field to display it, so 'display_name' = fields.related('partner_id', 'display_name', ....) and use 'display_name' in your view.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ธ.ค. 19
4903
4
ม.ค. 24
23157
Attrs attribute แก้ไขแล้ว
2
ม.ค. 24
2442
0
ส.ค. 23
2304
Selecting items for one2many relation แก้ไขแล้ว
2
ธ.ค. 22
14782