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>
This commit is contained in:
10
fusion_plating/scripts/fp_bol_pagecount.py
Normal file
10
fusion_plating/scripts/fp_bol_pagecount.py
Normal file
@@ -0,0 +1,10 @@
|
||||
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}')
|
||||
31
fusion_plating/scripts/fp_bol_pageverify.py
Normal file
31
fusion_plating/scripts/fp_bol_pageverify.py
Normal file
@@ -0,0 +1,31 @@
|
||||
env = env # noqa
|
||||
import subprocess, os
|
||||
rep = env.ref('fusion_plating_reports.action_report_fp_bol_landscape')
|
||||
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])
|
||||
path = '/tmp/bol_landscape.pdf'
|
||||
with open(path, 'wb') as f:
|
||||
f.write(pdf)
|
||||
print(f'wrote {len(pdf)/1024:.1f} KB to {path}')
|
||||
|
||||
# Extract text per page using pdftotext (poppler-utils)
|
||||
try:
|
||||
for p in (1, 2, 3):
|
||||
out = subprocess.run(
|
||||
['pdftotext', '-layout', '-f', str(p), '-l', str(p), path, '-'],
|
||||
capture_output=True, text=True, timeout=10
|
||||
)
|
||||
if out.returncode != 0 or not out.stdout.strip():
|
||||
continue
|
||||
text = out.stdout
|
||||
sig_labels = [
|
||||
'Shipper (Signature' in text,
|
||||
'Carrier / Driver' in text,
|
||||
'Consignee (Signature' in text,
|
||||
]
|
||||
cert_present = 'is to certify' in text
|
||||
print(f'PAGE {p}: cert={cert_present} sigs={sig_labels} '
|
||||
f'(all-3-sigs-together={all(sig_labels)})')
|
||||
except FileNotFoundError:
|
||||
print('pdftotext not installed — skipping per-page text check')
|
||||
Reference in New Issue
Block a user