feat(reports): hide Odoo's default PDFs where FP ships a branded one

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) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-19 08:57:38 -04:00
parent 5994cec11b
commit 9a1ee4b369
3 changed files with 115 additions and 1 deletions

View File

@@ -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,

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
Hide Odoo's default PDF reports from the Print dropdown wherever
Fusion Plating ships a branded equivalent. This prevents users from
accidentally sending the wrong (unbranded, missing-fields) PDF to
customers when both options are visible side by side.
Mechanism: setting `binding_model_id` to False (and `binding_type`
to 'action') removes the report from the model's Print dropdown but
leaves the underlying report record + template intact. An admin can
re-enable any of these from Settings → Technical → Actions → Reports
if needed (no schema change, fully reversible).
Reports we intentionally leave alone:
- sale.action_report_pro_forma_invoice (no FP pro-forma yet)
- account.action_account_original_vendor_bill
- stock.action_report_picking_packages (internal warehouse ops)
- stock.action_report_picking (internal warehouse ops)
- stock.return_label_report (internal returns)
- mrp.action_report_finished_product (production label, ZPL)
- mrp.label_manufacture_template (ZPL label)
- sale_timesheet.* (timesheet integration)
-->
<odoo noupdate="0">
<!-- ================================================================
sale.order — hide Odoo's PDF Quote + raw Quotation
FP ships fp_sale (portrait + landscape) with full plating layout
================================================================ -->
<record id="sale.action_report_saleorder" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<record id="sale_pdf_quote_builder.action_report_saleorder_raw" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<!-- ================================================================
account.move — hide Odoo's stock invoice PDFs
FP ships fp_invoice (portrait + landscape) with PO#, plating job
refs, deposit / progress / net-terms strategies built in
================================================================ -->
<record id="account.account_invoices" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<record id="account.account_invoices_without_payment" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<!-- ================================================================
stock.picking — hide Odoo's Delivery Slip
FP ships fp_packing_slip + fp_bol covering the customer-facing
shipping documents
================================================================ -->
<record id="stock.action_report_delivery" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<!-- ================================================================
mrp.production — hide Odoo's Production Order PDF
FP ships fp_job_traveller as the shop-floor router / traveller
================================================================ -->
<record id="mrp.action_report_production_order" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
<!-- ================================================================
account.payment — hide Odoo's Payment Receipt
FP ships fp_receipt with PO# and plating job context
================================================================ -->
<record id="account.action_report_payment_receipt" model="ir.actions.report">
<field name="binding_model_id" eval="False"/>
<field name="binding_type">action</field>
</record>
</odoo>

View File

@@ -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]}')