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

Hi,

I spent a few hours on that and i can't find my error.


When i try to generate a report in Python:


​​ report_name = "studio_report_docume_09ae2ee5-71e3-4d54-ae5a-16e39b29ca91"

          report = env["ir.actions.report"]._get_report_from_name(report_name)

          pdf = report._render_qweb_pdf(record.id)


I have an error saying:

Record does not exist or has been deleted. (Record: ir.actions.report(180,), User: 2)


The record.id (180) in this example exists.


Does someone can tell me where i'm wrong please ??


Thanks


อวตาร
ละทิ้ง
ผู้เขียน

Thanks! It's working !!
I'm seing that it creates automatically an record in ir.attachment which is great.
Do you know how can I get the id of this record ?

Thanks !!


คำตอบที่ดีที่สุด

Hello Morgan Fellous,

Please find code in comment. 

Hope it will be helpful to you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwar

อวตาร
ละทิ้ง

Please find code here :-

You should try this structure to print report:

report_name = "module_name.studio_report_docume_09ae2ee5-71e3-4d54-ae5a-16e39b29ca91"

report = self.env["ir.actions.report"].sudo()._render_qweb_pdf(report_name, record.id)

คำตอบที่ดีที่สุด

Hi,

Try like below

pdf = self.env["ir.actions.report"].sudo()._render_qweb_pdf(
self.env.ref('module_name.report_record_name').id,
res_ids=self.ids, data=record)

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 24
1881
1
มิ.ย. 23
2744
1
เม.ย. 23
2339
3
ก.พ. 23
4536
1
ธ.ค. 22
1801