env = env # noqa import re rep = env.ref('fusion_plating_reports.action_report_fp_bol_portrait') dlv = env['fusion.plating.delivery'].search([], order='id desc', limit=1) html, _ = rep.with_context(force_report_rendering=True )._render_qweb_html(rep.report_name, [dlv.id]) out = html.decode() if isinstance(html, bytes) else str(html) # Extract the sig-table block + 200 chars before and after m = re.search(r'(.{0,400})(