Help

0

Custom model 'contact' widget does not display street address?

Avatar
Mike clarke

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
1 Answer
0
Avatar
Mike clarke
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