Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
13937 มุมมอง

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
4276
0
มี.ค. 15
12169
1
เม.ย. 25
1189
2
มี.ค. 25
1326
4
พ.ย. 24
7049