Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
6571 Представления

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
Аватар
Отменить
Автор Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
сент. 16
4641
1
июл. 24
2782
1
февр. 24
2999
1
июл. 23
5163
0
мар. 24
3952