Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
13948 Переглядів

Hi,

I would like to create a PDF report using Qweb with customer address on the right side.

 The res_model is 'res.partner' and here is my code

<template id="customer_payment">
<t
t-call="web.html_container">
<t
t-foreach="docs" t-as="o">
<t
t-call="web.external_layout">
<t
t-set="address">
<address
t-field="o.id"
                            t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'/>
</t>
<div
class="page">

</div>
</t>
</t>
</t>
</template>

The error appeared like this:

AttributeError: 'int' object has no attribute 'exists'

odoo.addons.base.models.qweb.QWebException: 'int' object has no attribute 'exists'

I think because 'o.id' is Integer, but other reports use 'o.partner_id' and it works.

When I delete t-options statement, the report was generated successfully without customer address.

Help me, please!

Thank you!


Аватар
Відмінити
Найкраща відповідь

Hello @ThanhPs,

You can use this code for display address in QWeb report.


<span t-field="o.partner_id" 

    t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, 

    &quot;name&quot;, &quot;phone&quot;], &quot;no_marker&quot;: True}"/>

Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Аватар
Відмінити
Автор

Hello @Aktiv software,

As I mentioned in my question, I am using 'res.partner' as my model therefore have no field name is 'partner_id'.

It showed an error.

Btw, thank you for your help!

Автор

I am so sorry,

I tested again with o.partner_id, however cause the values of partner_id = NULL & is_company = TRUE then nothing display in address area. Do you have any other solution?

<address t-field="o"

t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'/>

Найкраща відповідь
< span t-field = "o.partner_id.state_id" /> hãy thử xem 
Аватар
Відмінити
Автор

It did not work! :(

Btw, cám ơn nhiều

Related Posts Відповіді Переглядів Дія
0
жовт. 15
4278
0
бер. 15
12178
1
квіт. 25
1197
2
бер. 25
1330
4
лист. 24
7053