跳至内容
菜单
此问题已终结
1 回复
5684 查看

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)

相关帖文 回复 查看 活动
1
11月 17
5754
4
10月 17
26347
1
6月 17
9594
1
9月 19
3631
1
9月 17
3499