Skip to Content
Menu
This question has been flagged

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
Discard
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
Discard
Author

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

Author

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 Replies Views Activity
2
Jul 22
1494
1
Oct 16
9541
0
Apr 22
1592
4
Mar 22
15804
0
Sep 21
1250