Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5732 Visualizzazioni

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

 

Avatar
Abbandona
Risposta migliore

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)
Avatar
Abbandona
Autore

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)

Post correlati Risposte Visualizzazioni Attività
1
nov 17
5868
4
ott 17
26417
1
giu 17
9636
1
set 19
3685
1
set 17
3543