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

I created paper format for my custom report from odoo or in a template. The paperformat is linked to the report, but the report is always in Portrait orientation.

Do I need to set something on the report? 

And this forum still doesn't show template code!


A4 Services provided for customer

A4
0
0
Landscape
15
15
9
9

3
90

 

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

In Odoo 10 landscape format is defined through the context. Thus, in order to make your report landscape you should pass the param 'landscape' as True while generating your pdf. The example from the 'account' module:

return self.env['report'].with_context(landscape=True).get_action(records, 'account.report_generalledger', data=data)
อวตาร
ละทิ้ง
ผู้เขียน

Thanks! I hate when the documentation and books are wrong. With your answer I got it working in a second.

document = self.env['report'].with_context(landscape=True).get_pdf([self.id], report_name)

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ย. 17
6049
4
ต.ค. 17
26670
1
มิ.ย. 17
9813
1
ก.ย. 19
3870
1
ก.ย. 17
3662