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

How to create reports in odoo i know,

but how to load a template from a file (/home/templates/template.xml) and then transfer it to a report?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Gleb,

i think you want to generate report from background (python side) or from other model/resource.

you can do like this:

                # render report and get as pdf

                REPORT_ID = 'moduleName.template_id' # template id (that you have to find from report template)

                pdf = self.env.ref(REPORT_ID).render_qweb_pdf(record_id) # Give record id to generate for

                b64_pdf = base64.b64encode(pdf[0])

Now you will get pdf in b64_pdf so you can set this as attachment or send as email whatever you want 
 

https://goo.gl/TqYCYX


don't forget to accept answer if helpful.

thank you

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

f you mean that "/home" is a module directory,, then you just can call template by <t t-call="home.template_xml_id" />


Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
QWeb report แก้ไขแล้ว
1
ม.ค. 19
3850
2
เม.ย. 25
6104
0
ก.ย. 22
3913
0
มี.ค. 22
6796
2
ส.ค. 25
438