Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
5306 Prikazi

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
Opusti
Best Answer

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
Opusti
Avtor

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

Avtor

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.

Related Posts Odgovori Prikazi Aktivnost
2
jul. 22
1494
1
okt. 16
10770
0
apr. 22
2705
4
mar. 22
17555
0
sep. 21
2405