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:
gsinghpal
2026-04-19 07:14:33 -04:00
parent c450bb203e
commit 16a4bdddf3
4 changed files with 53 additions and 7 deletions

View File

@@ -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': [

View File

@@ -46,9 +46,14 @@
</td>
<td style="height: 90px;">
<strong><span t-field="doc.partner_id.name"/></strong><br/>
<t t-set="dest" t-value="doc.delivery_address_id or doc.partner_id"/>
<div t-field="dest"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
<t t-if="doc.delivery_address_id">
<div t-field="doc.delivery_address_id"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
</t>
<t t-else="">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
</t>
<t t-if="doc.contact_name">
<strong>Attn: </strong><span t-field="doc.contact_name"/><br/>
</t>
@@ -232,9 +237,14 @@
</td>
<td style="height: 100px; font-size: 12pt;">
<strong><span t-field="doc.partner_id.name"/></strong><br/>
<t t-set="dest" t-value="doc.delivery_address_id or doc.partner_id"/>
<div t-field="dest"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
<t t-if="doc.delivery_address_id">
<div t-field="doc.delivery_address_id"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
</t>
<t t-else="">
<div t-field="doc.partner_id"
t-options="{'widget': 'contact', 'fields': ['address', 'phone'], 'no_marker': True}"/>
</t>
<t t-if="doc.contact_name">
<strong>Attn: </strong><span t-field="doc.contact_name"/><br/>
</t>