env = env # noqa rep = env.ref('fusion_plating_reports.action_report_fp_bol_portrait') dlv = env['fusion.plating.delivery'].search([], order='id desc', limit=1) pdf, _ = rep.with_context(force_report_rendering=True )._render_qweb_pdf(rep.report_name, [dlv.id]) with open('/tmp/bol_portrait.pdf', 'wb') as f: f.write(pdf) print(f'wrote {len(pdf)/1024:.1f} KB')