fix(portal): use FP custom sale report for SO Confirmation download

Standard sale.report_saleorder hit the sale_pdf_quote_builder
header/footer merge bug (CLAUDE.md MEMORY.md gotcha) and produced
garbled PDFs on FP-customised sale orders. Switching to
fusion_plating_reports.report_fp_sale_portrait which is the
customer-facing FP template and bypasses the merge gate. Added
?download=true so the browser saves the PDF instead of trying to
embed it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-17 03:24:56 -04:00
parent d3c5c25865
commit 8e172132e7

View File

@@ -197,12 +197,17 @@ class FpCustomerPortal(CustomerPortal):
if backend_job and 'sale_order_id' in backend_job._fields: if backend_job and 'sale_order_id' in backend_job._fields:
so = backend_job.sale_order_id so = backend_job.sale_order_id
if so: if so:
# IMPORTANT: use the FP custom sale report, NOT sale.report_saleorder.
# Per CLAUDE.md, sale_pdf_quote_builder gates on report_name being
# 'sale.report_saleorder' EXACTLY and produces broken output when
# the standard template is hit on FP-customised sale orders.
# report_fp_sale_portrait is the customer-facing template.
groups[0]['docs'].append({ groups[0]['docs'].append({
'label': 'Sales Order Confirmation · %s' % so.name, 'label': 'Sales Order Confirmation · %s' % so.name,
'sub': 'EN Plating · %s' % ( 'sub': 'EN Plating · %s' % (
so.date_order and so.date_order.strftime('%b %d, %Y') or '' so.date_order and so.date_order.strftime('%b %d, %Y') or ''
), ),
'url': '/report/pdf/sale.report_saleorder/%s' % so.id, 'url': '/report/pdf/fusion_plating_reports.report_fp_sale_portrait/%s?download=true' % so.id,
'icon_class': 'o_fp_doc_icon_input', 'icon_class': 'o_fp_doc_icon_input',
'icon': '📄', 'icon': '📄',
}) })