Files
Odoo-Modules/fusion_plating/scripts/fp_bol_pagecount.py
gsinghpal b16486f66b fix(reports): keep BoL signature row intact across page breaks
Landscape BoL was splitting the signature row down the middle —
boxes half on page 1, half on page 2. Two complementary fixes:

1. **Per-element rule**: added `page-break-inside: avoid` +
   `break-inside: avoid` to `.sig-box` (both portrait + landscape
   styles) so an individual signature box can never split across
   pages.

2. **Wrapper rule**: introduced `.fp-keep-together` utility +
   wrapped the BoL's certification statement + signature row in
   it, so the whole "sign here" block moves to the next page as
   one unit if it doesn't fit. Also applied
   `page-break-inside: avoid` to `table tr` so cargo lines don't
   split mid-row either.

Lives in shared `report_base_styles.xml` so any FP template that
opts into `.fp-keep-together` benefits automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 07:35:55 -04:00

11 lines
533 B
Python

env = env # noqa
import re
for variant in ('portrait', 'landscape'):
rep = env.ref(f'fusion_plating_reports.action_report_fp_bol_{variant}')
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])
# Count pages by looking at the /Type /Page (not /Pages) markers
n_pages = len(re.findall(rb'/Type\s*/Page[^s]', pdf))
print(f'{variant:10s} {len(pdf)/1024:6.1f} KB pages={n_pages}')