Files
Odoo-Modules/fusion_plating/scripts/fp_bol_pageverify.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

32 lines
1.2 KiB
Python

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')