Skip to Content
Menu
This question has been flagged
1 Reply
5201 Views

Hi all,

I have a custom model to which I have added the "standard" address fields. Namely: name, street, street2, city, country_id, state_id. I also have website, phone and email

I have a qweb report and I want to use the contact widget to format this address. I have the following code snippet in the report:

<span t-field="o.mymodel_id" t-if="o.mymodel_id"
t-field-options='{"widget": "contact", "fields": ["address", "city", "name","email","phone","website"], "no_marker": true}'
style="border-bottom: 1px solid black; display:inline-block;"/>


The address that prints on the report shows city,email, website. name and phone but no street address. I have added a compute field to my model to provide the address field. I searched the code base for example code to define and return an address but couldnt find where this field in defined for the core classes. This is what I tried but the street details will not print.

address = fields.Char(compute="_address", readonly=True)


@api.multi
@api.depends
('street', 'street2')
def _address(self):
for rec in self:
rec.address = rec.street+"\n" + rec.street2
Avatar
Discard
Author Best Answer

After some investigation it emerged that you the contact widget relies on the "name_get" function in your class for the display logic for an address.

Avatar
Discard
Related Posts Replies Views Activity
4
Sep 16
3795
1
Jul 24
409
1
Feb 24
419
1
Jul 23
3224
0
Mar 24
1988