İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5279 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

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

Üretici

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.

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Tem 22
1494
1
Eki 16
10717
0
Nis 22
2658
4
Mar 22
17517
0
Eyl 21
2331