Se rendre au contenu
Menu
Cette question a été signalée

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur

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

Auteur

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.

Publications associées Réponses Vues Activité
2
juil. 22
1494
1
oct. 16
10777
0
avr. 22
2711
4
mars 22
17558
0
sept. 21
2406