From 9a1ee4b36998636ad7642415d30f1314f7056822 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 19 Apr 2026 08:57:38 -0400 Subject: [PATCH] feat(reports): hide Odoo's default PDFs where FP ships a branded one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users were seeing both Odoo's stock PDFs and FP's branded equivalents in the Print dropdown side-by-side, and accidentally sending the wrong (unbranded, missing PO# / job ref / plating fields) PDF to customers. Add fp_hide_default_reports.xml that drops the Print-menu binding on: | Model | Hidden | FP replacement | |-----------------|-------------------------------------------------------------|---------------------------------| | sale.order | sale.action_report_saleorder | action_report_fp_sale_* | | sale.order | sale_pdf_quote_builder.action_report_saleorder_raw | action_report_fp_sale_* | | account.move | account.account_invoices | action_report_fp_invoice_* | | account.move | account.account_invoices_without_payment | action_report_fp_invoice_* | | stock.picking | stock.action_report_delivery | action_report_fp_packing_slip_* | | mrp.production | mrp.action_report_production_order | action_report_fp_job_traveller_*| | account.payment | account.action_report_payment_receipt | action_report_fp_receipt_* | Mechanism: set binding_model_id=False + binding_type=action — removes from the Print dropdown but leaves the report record + template intact. Fully reversible from Settings → Technical → Reports if anyone needs the stock PDF back. Intentionally NOT touched: - sale.action_report_pro_forma_invoice (no FP pro-forma yet) - account.action_account_original_vendor_bill (vendor bills, internal) - stock.action_report_picking / picking_packages / return_label_report (internal warehouse ops, not customer-facing) - mrp.action_report_finished_product / mrp.label_manufacture_template (production labels — ZPL, not customer-facing) - sale_timesheet.* (timesheet integration) Added sale_pdf_quote_builder to depends so the data file always finds that record when applied (it ships in entech's repackaged enterprise bundle and was already installed there). Verified on entech: re-running the print-menu audit shows zero stock Odoo customer-facing PDFs left where FP has an equivalent. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_reports/__manifest__.py | 7 +- .../data/fp_hide_default_reports.xml | 85 +++++++++++++++++++ fusion_plating/scripts/fp_audit_reports.py | 24 ++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 fusion_plating/fusion_plating_reports/data/fp_hide_default_reports.xml create mode 100644 fusion_plating/scripts/fp_audit_reports.py diff --git a/fusion_plating/fusion_plating_reports/__manifest__.py b/fusion_plating/fusion_plating_reports/__manifest__.py index a93caaa3..5cd85d9b 100644 --- a/fusion_plating/fusion_plating_reports/__manifest__.py +++ b/fusion_plating/fusion_plating_reports/__manifest__.py @@ -3,11 +3,12 @@ # License OPL-1 (Odoo Proprietary License v1.0) { 'name': 'Fusion Plating — Reports', - 'version': '19.0.4.7.0', + 'version': '19.0.4.8.0', 'category': 'Manufacturing/Plating', 'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.', 'depends': [ 'sale', + 'sale_pdf_quote_builder', 'account', 'stock', 'mrp', @@ -45,6 +46,10 @@ 'report/report_fp_bol.xml', 'report/report_fp_invoice.xml', 'report/report_fp_receipt.xml', + # Hide Odoo's default reports from the Print menu wherever FP + # ships an equivalent (loaded last so it overrides any earlier + # binding declarations from base modules). + 'data/fp_hide_default_reports.xml', ], 'installable': True, 'application': False, diff --git a/fusion_plating/fusion_plating_reports/data/fp_hide_default_reports.xml b/fusion_plating/fusion_plating_reports/data/fp_hide_default_reports.xml new file mode 100644 index 00000000..80425cb6 --- /dev/null +++ b/fusion_plating/fusion_plating_reports/data/fp_hide_default_reports.xml @@ -0,0 +1,85 @@ + + + + + + + + action + + + + action + + + + + + action + + + + action + + + + + + action + + + + + + action + + + + + + action + + + diff --git a/fusion_plating/scripts/fp_audit_reports.py b/fusion_plating/scripts/fp_audit_reports.py new file mode 100644 index 00000000..e91fa558 --- /dev/null +++ b/fusion_plating/scripts/fp_audit_reports.py @@ -0,0 +1,24 @@ +env = env # noqa +# List all ir.actions.report bindings on the models we care about +MODELS = ['sale.order', 'account.move', 'stock.picking', 'mrp.production', + 'fusion.plating.delivery', 'account.payment', 'fusion.plating.portal.job', + 'fp.certificate'] +print(f'{"model":<32} {"xmlid":<55} {"name":<40}') +print('-' * 130) +for m in MODELS: + model = env['ir.model'].search([('model', '=', m)], limit=1) + if not model: + continue + reports = env['ir.actions.report'].search([ + ('binding_model_id', '=', model.id), + ('binding_type', '=', 'report'), + ]) + for r in reports: + # Get the xmlid + xmlids = env['ir.model.data'].search([ + ('model', '=', 'ir.actions.report'), ('res_id', '=', r.id) + ]) + xmlid = ', '.join(f'{x.module}.{x.name}' for x in xmlids) or '(no xmlid)' + is_fp = 'fusion_plating' in xmlid + marker = '✓ FP' if is_fp else ' ' + print(f' {marker} {m:<28} {xmlid:<55} {r.name[:40]}')