fix(plating): CoC + invoice PDFs render full content

Three reported PDF bugs from the customer-facing email package:

1. Invoice body was empty — Odoo 19 sets display_type='product' on
   regular invoice/SO lines (was empty string in 18.0). Both
   report_fp_invoice.xml and report_fp_sale.xml only matched
   `not line.display_type`, so every product line was skipped.
   Fixed both portrait + landscape variants to also match
   display_type == 'product'.

2. CoC PDF was a bare 30 KB header — _fp_generate_cert_pdf was
   rendering action_report_coc, which is bound to portal_job and
   has minimal content. Rewrote to use the rich fp.certificate-bound
   report (action_report_coc_en / action_report_coc_fr based on
   cert.partner_id.lang) and slugged the filename to
   CoC-<Customer>-<CertName>.pdf so the email attachment reads
   nicely instead of CERT-00123.pdf.

3. Thickness cert was an exact duplicate of the CoC — the CoC
   template already embeds thickness readings. Skip thickness cert
   creation entirely when the customer also wants CoC; only create
   a standalone thickness cert when the customer opted out of CoC.

Also: dispatcher in fp_notification_template now prefers
portal_job.coc_attachment_id (the rich one we just generated) and
falls back to rendering action_report_coc_en against fp.certificate
by partner.lang — never the bare portal-job report.

Versions bumped: bridge_mrp 19.0.6.0.0, notifications 19.0.4.0.0,
reports 19.0.4.0.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-19 01:16:27 -04:00
parent 167c423bf5
commit 633427bcf8
7 changed files with 93 additions and 38 deletions

View File

@@ -3,7 +3,7 @@
# License OPL-1 (Odoo Proprietary License v1.0)
{
'name': 'Fusion Plating — Reports',
'version': '19.0.3.0.0',
'version': '19.0.4.0.0',
'category': 'Manufacturing/Plating',
'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.',
'depends': [

View File

@@ -97,7 +97,7 @@
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td colspan="7"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="not line.display_type">
<t t-elif="not line.display_type or line.display_type == 'product'">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td>
@@ -290,7 +290,7 @@
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td t-att-colspan="col_count"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="not line.display_type">
<t t-elif="not line.display_type or line.display_type == 'product'">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td>

View File

@@ -118,7 +118,7 @@
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td colspan="7"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="not line.display_type">
<t t-elif="not line.display_type or line.display_type == 'product'">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td>
@@ -351,7 +351,7 @@
<t t-elif="line.display_type == 'line_note'">
<tr class="note-row"><td t-att-colspan="col_count"><span t-field="line.name"/></td></tr>
</t>
<t t-elif="not line.display_type">
<t t-elif="not line.display_type or line.display_type == 'product'">
<tr>
<td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
<td>