From 8e172132e760b09e845ca4f6f74196bb600c7b27 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 17 May 2026 03:24:56 -0400 Subject: [PATCH] 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) --- fusion_plating/fusion_plating_portal/controllers/portal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fusion_plating/fusion_plating_portal/controllers/portal.py b/fusion_plating/fusion_plating_portal/controllers/portal.py index d6b9f4c0..6ca07f0a 100644 --- a/fusion_plating/fusion_plating_portal/controllers/portal.py +++ b/fusion_plating/fusion_plating_portal/controllers/portal.py @@ -197,12 +197,17 @@ class FpCustomerPortal(CustomerPortal): if backend_job and 'sale_order_id' in backend_job._fields: so = backend_job.sale_order_id 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({ 'label': 'Sales Order Confirmation · %s' % so.name, 'sub': 'EN Plating · %s' % ( 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': '📄', })