From 16a4bdddf3fa59ca57a3da4b8048b27c9ff69a26 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 07:14:33 -0400 Subject: [PATCH] =?UTF-8?q?fix(reports):=20BoL=20PDF=20=E2=80=94=20t-field?= =?UTF-8?q?=20needs=20dotted=20path,=20branch=20on=20delivery=5Faddress=5F?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Bill of Lading template assigned a temp variable `` and then tried `
`. Odoo 19 QWeb asserts t-field must be `record.field_name` (have a dot) — the temp variable form fails compilation and the report renders as a multi-page "Oops! Something went wrong" PDF stuffed with the traceback. Fix: branch with `t-if`/`t-else` and call `t-field="doc.delivery_address_id"` or `t-field="doc.partner_id"` directly. Same pattern in both header and second-page-header sections (lines 49/235). Verified: BoL render goes from 39 KB error page to 138 KB clean PDF. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_reports/__manifest__.py | 2 +- .../report/report_fp_bol.xml | 22 ++++++++++++++----- fusion_plating/scripts/fp_bol_html.py | 22 +++++++++++++++++++ fusion_plating/scripts/fp_bol_repro.py | 14 ++++++++++++ 4 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 fusion_plating/scripts/fp_bol_html.py create mode 100644 fusion_plating/scripts/fp_bol_repro.py diff --git a/fusion_plating/fusion_plating_reports/__manifest__.py b/fusion_plating/fusion_plating_reports/__manifest__.py index 571adc29..31cc9603 100644 --- a/fusion_plating/fusion_plating_reports/__manifest__.py +++ b/fusion_plating/fusion_plating_reports/__manifest__.py @@ -3,7 +3,7 @@ # License OPL-1 (Odoo Proprietary License v1.0) { 'name': 'Fusion Plating — Reports', - 'version': '19.0.4.0.0', + 'version': '19.0.4.1.0', 'category': 'Manufacturing/Plating', 'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.', 'depends': [ diff --git a/fusion_plating/fusion_plating_reports/report/report_fp_bol.xml b/fusion_plating/fusion_plating_reports/report/report_fp_bol.xml index 3317984d..3e36e3fc 100644 --- a/fusion_plating/fusion_plating_reports/report/report_fp_bol.xml +++ b/fusion_plating/fusion_plating_reports/report/report_fp_bol.xml @@ -46,9 +46,14 @@
- -
+ +
+ + +
+ Attn:
@@ -232,9 +237,14 @@
- -
+ +
+ + +
+ Attn:
diff --git a/fusion_plating/scripts/fp_bol_html.py b/fusion_plating/scripts/fp_bol_html.py new file mode 100644 index 00000000..973a39d2 --- /dev/null +++ b/fusion_plating/scripts/fp_bol_html.py @@ -0,0 +1,22 @@ +# Render BoL HTML body to see the real error +import traceback +env = env # noqa +report = env.ref('fusion_plating_reports.action_report_fp_bol_portrait') +dlv = env['fusion.plating.delivery'].search([], order='id desc', limit=1) +print('rendering HTML for:', dlv.name, 'id=', dlv.id) +try: + html, _ = report.with_context(force_report_rendering=True + )._render_qweb_html(report.report_name, [dlv.id]) + out = html.decode() if isinstance(html, bytes) else str(html) + print('HTML length:', len(out)) + # Show beginning + look for Traceback markers + if 'Traceback' in out or 'Oops' in out: + idx = max(out.find('Traceback'), out.find('Oops')) + print('--- ERROR SECTION ---') + print(out[idx:idx+3000]) + else: + print('--- FIRST 800 CHARS ---') + print(out[:800]) +except Exception: + print('--- DIRECT EXCEPTION ---') + traceback.print_exc() diff --git a/fusion_plating/scripts/fp_bol_repro.py b/fusion_plating/scripts/fp_bol_repro.py new file mode 100644 index 00000000..179870d6 --- /dev/null +++ b/fusion_plating/scripts/fp_bol_repro.py @@ -0,0 +1,14 @@ +# Reproduce BoL render error +import traceback +env = env # noqa +report = env.ref('fusion_plating_reports.action_report_fp_bol_portrait') +print('report:', report.report_name, 'model:', report.model) +dlv = env['fusion.plating.delivery'].search([], order='id desc', limit=1) +print('rendering for:', dlv.name, 'id=', dlv.id, 'state=', dlv.state) +try: + pdf, _ = report.with_context(force_report_rendering=True + )._render_qweb_pdf(report.report_name, [dlv.id]) + print('OK pdf size:', len(pdf), 'bytes') +except Exception: + print('--- TRACEBACK ---') + traceback.print_exc()