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:
24
fusion_plating/scripts/fp_audit_reports.py
Normal file
24
fusion_plating/scripts/fp_audit_reports.py
Normal 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]}')
|
||||
Reference in New Issue
Block a user