fix(notifications): mail.template only refs core fp.job fields
Entech deploy of 5a039ae3 hit:
ParseError: Failed to render inline_template template
AttributeError('fp.job' object has no attribute 'display_wo_name')
Root cause: mail.template data files are parse-time validated by
Odoo (template rendered against sample object). fusion_plating_notifications
loads BEFORE fusion_plating_jobs in dep order, so jobs-module fields
(display_wo_name, part_catalog_id) aren't on the Python class yet
even though the DB columns exist from previous installs.
Fix: strip display_wo_name → name and remove the Part row.
Recipe / qty_done / partner_id stay (all in fusion_plating core).
Logged as CLAUDE.md Rule #24 — same trap will bite anyone else
adding cross-module mail templates. Includes structural alternatives
for callers that really need downstream fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,12 @@
|
||||
<record id="fp_mail_template_cert_awaiting_issuance" model="mail.template">
|
||||
<field name="name">FP: Cert Awaiting Issuance</field>
|
||||
<field name="model_id" ref="fusion_plating.model_fp_job"/>
|
||||
<field name="subject">🏷️ Job {{ object.display_wo_name or object.name }} ready for CoC issuance</field>
|
||||
<!-- Only reference CORE fp.job fields here. The notifications
|
||||
module loads BEFORE fusion_plating_jobs in dep order, and
|
||||
mail.template parsing renders subject/body once to validate
|
||||
— fields added by inheriting modules (display_wo_name,
|
||||
part_catalog_id) would AttributeError at parse time. -->
|
||||
<field name="subject">🏷️ Job {{ object.name }} ready for CoC issuance</field>
|
||||
<field name="email_from">{{ (object.company_id.email or user.email) }}</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="body_html" type="html">
|
||||
@@ -33,7 +38,7 @@
|
||||
</div>
|
||||
<h2 style="margin: 0 0 8px 0; font-size: 22px; font-weight: bold;">CoC Awaiting Issuance</h2>
|
||||
<p style="margin: 0 0 20px 0; font-size: 15px; opacity: 0.75;">
|
||||
Job <strong t-out="object.display_wo_name or object.name"/>
|
||||
Job <strong t-out="object.name"/>
|
||||
(<t t-out="object.partner_id.name"/>) has finished the shop floor
|
||||
and is awaiting CoC issuance.
|
||||
</p>
|
||||
@@ -46,12 +51,6 @@
|
||||
<td style="padding: 8px 4px;">Customer</td>
|
||||
<td style="padding: 8px 4px; text-align: right;"><t t-out="object.partner_id.name or ''"/></td>
|
||||
</tr>
|
||||
<tr style="border-bottom: 1px solid rgba(128,128,128,0.25);">
|
||||
<td style="padding: 8px 4px;">Part</td>
|
||||
<td style="padding: 8px 4px; text-align: right; font-family: monospace;">
|
||||
<t t-out="(object.part_catalog_id.part_number if object.part_catalog_id else '') or '—'"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="border-bottom: 1px solid rgba(128,128,128,0.25);">
|
||||
<td style="padding: 8px 4px;">Quantity</td>
|
||||
<td style="padding: 8px 4px; text-align: right;"><t t-out="object.qty_done or 0"/></td>
|
||||
@@ -91,7 +90,7 @@
|
||||
<record id="fp_mail_template_cert_voided_re_notify" model="mail.template">
|
||||
<field name="name">FP: Cert Voided — Re-Issue</field>
|
||||
<field name="model_id" ref="fusion_plating.model_fp_job"/>
|
||||
<field name="subject">⚠️ Job {{ object.display_wo_name or object.name }} CoC voided — please re-issue</field>
|
||||
<field name="subject">⚠️ Job {{ object.name }} CoC voided — please re-issue</field>
|
||||
<field name="email_from">{{ (object.company_id.email or user.email) }}</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="body_html" type="html">
|
||||
@@ -103,7 +102,7 @@
|
||||
<h2 style="margin: 0 0 8px 0; font-size: 22px; font-weight: bold;">CoC Voided — Please Re-Issue</h2>
|
||||
<p style="margin: 0 0 20px 0; font-size: 15px; opacity: 0.75;">
|
||||
A previously-issued CoC for job
|
||||
<strong t-out="object.display_wo_name or object.name"/>
|
||||
<strong t-out="object.name"/>
|
||||
(<t t-out="object.partner_id.name"/>) was voided. The job has
|
||||
slid back to <em>Awaiting Cert</em> and is waiting for re-issuance.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user