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

I want to print a report from a python method and the code i actually have isn't working, i got a error like this :

File "/odoo/odoo-server/odoo/modules/registry.py", line 181, in __getitem__

    return self.models[model_name]

KeyError: 'report'


and the code i have is :

 @api.multi

    def sample_report_from_method(self):

        return self.env['report'].get_action('custom.custom_report_demo')


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

Hi,

Are you using Odoo v11?  In the V11 there are some changes in the report section,  report module has been removed along with report object. For this reason, you are facing this error.


In v11, you can call the report using report_action  as follow:

self.env.ref('custom_report_name').report_action(self, data=data)


For more have a look at this answer too: https://www.odoo.com/forum/help-1/question/report-in-odoo-11-125808#answer-127020

For calling a python function and return data to the report template see this video : How To Call A Python Function While Printing PDF Report in Odoo

Thanks

 

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

Please anyone can help me in this related to odoo11 report printing on website.

Please click on link:

https://stackoverflow.com/questions/52829692/how-to-print-report-from-website-in-odoo11

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Qweb decimal point in reports แก้ไขแล้ว
6
ก.ค. 22
39991
1
ม.ค. 24
1059
4
พ.ย. 22
11235
Show Report in HTML field - Odoo 14 แก้ไขแล้ว
2
พ.ค. 21
6728
Repeat Header On Every Page In Report แก้ไขแล้ว
1
พ.ค. 24
13051