Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
5283 Vistas

Hi, 

I'm trying to edit our task view to display customers phone, address etc. fields without need to open customer form view.

Can someone shed light how to display this fields which are related to other object in the task form view please?
If possible I want to do this entirely from web (developer mode: Edit, view, form)

Any help or suggestion will be appreciated.  Thanks.

Avatar
Descartar
Mejor respuesta

Hi Marek,

You can create a RELATED field in your case.

Ex:

phone = fields.Char('Phone', related='partner_id.phone', readonly=True)
street = fields.Char('Street', related='partner_id.street', readonly=True)
.....

This way you can show the fields and their value from the selected partner.

Hope this will help you.


Avatar
Descartar
Autor

I don't know where and how should I use it. Can you please be more specific in the answer? I asked for solution related to xml view that can be changed using developer mode in the web interface. In case it is not possible this way please direct me to the tutorial where I can find detailed information. Thanks

Autor

Finally it works. Added foloowing related fields in file .../odoo/addons/project/models/project.py :

class Task(models.Model)

...

city = fields.Char('City', related='partner_id.city', readonly=True)

street = fields.Char('Street', related='partner_id.street', readonly=True)

phone = fields.Char('Phone', related='partner_id.phone', readonly=True)

...

Restart server, and use related field it in xml view editor of developer mode:

<field name="phone" />

...

Great but it is recommended to create a module for all the customization.

Publicaciones relacionadas Respuestas Vistas Actividad
2
jul 22
1494
1
oct 16
10727
0
abr 22
2663
4
mar 22
17524
0
sept 21
2337