Skip to Content
Menú
This question has been flagged
4 Respostes
13536 Vistes

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!


Avatar
Descartar
Best Answer

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

   

Avatar
Descartar
Autor

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!

Autor

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"]}'/>

Best Answer
< span t-field = "o.partner_id.state_id" /> hãy thử xem 
Avatar
Descartar
Autor

It did not work! :(

Btw, cám ơn nhiều

Related Posts Respostes Vistes Activitat
0
d’oct. 15
4047
0
de març 15
11776
1
d’abr. 25
719
2
de març 25
816
4
de nov. 24
6540