跳至内容
菜单
此问题已终结
2 回复
21275 查看

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.

形象
丢弃
相关帖文 回复 查看 活动
2
12月 19
4889
4
1月 24
23085
2
1月 24
2407
0
8月 23
2280
2
12月 22
14749