fix(reports): BoL PDF — t-field needs dotted path, branch on delivery_address_id
The Bill of Lading template assigned a temp variable `<t t-set="dest" t-value="doc.delivery_address_id or doc.partner_id"/>` and then tried `<div t-field="dest" .../>`. 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) <noreply@anthropic.com>
This commit is contained in:
22
fusion_plating/scripts/fp_bol_html.py
Normal file
22
fusion_plating/scripts/fp_bol_html.py
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user