This question has been flagged
4 Replies
11619 Views

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
Discard
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
Discard
Author

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!

Author

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
Discard
Author

It did not work! :(

Btw, cám ơn nhiều