changes
This commit is contained in:
1
fusion_reports_templates/controllers/__init__.py
Normal file
1
fusion_reports_templates/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import portal
|
||||
39
fusion_reports_templates/controllers/portal.py
Normal file
39
fusion_reports_templates/controllers/portal.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
"""Swap stock report refs for their Fusion-branded equivalents in customer/vendor
|
||||
portal routes.
|
||||
|
||||
The portal "View Details" link and the portal Download button in
|
||||
`sale/account/purchase/controllers/portal.py` hard-code the stock report
|
||||
(`sale.action_report_saleorder`, `account.account_invoices`, ...). All those
|
||||
routes funnel through `CustomerPortal._show_report` in
|
||||
`portal/controllers/portal.py`, so a single override on that method is enough
|
||||
to redirect every customer-facing render to the Fusion templates that
|
||||
`mail_template_override.xml` already uses for outbound email.
|
||||
"""
|
||||
from odoo.addons.portal.controllers import portal
|
||||
|
||||
|
||||
_PORTAL_REPORT_OVERRIDES = {
|
||||
# Sale: quotation / order
|
||||
'sale.action_report_saleorder': 'fusion_reports_templates.action_report_fr_sale_portrait',
|
||||
# Account: customer invoice + credit note (with-payment and without-payment variants)
|
||||
'account.account_invoices': 'fusion_reports_templates.action_report_fr_invoice_portrait',
|
||||
'account.account_invoices_without_payment': 'fusion_reports_templates.action_report_fr_invoice_portrait',
|
||||
# Purchase: PO + RFQ (vendor portal)
|
||||
'purchase.action_report_purchase_order': 'fusion_reports_templates.action_report_fr_purchase_portrait',
|
||||
'purchase.report_purchase_quotation': 'fusion_reports_templates.action_report_fr_purchase_portrait',
|
||||
}
|
||||
|
||||
|
||||
class CustomerPortal(portal.CustomerPortal):
|
||||
|
||||
def _show_report(self, model, report_type, report_ref, download=False):
|
||||
report_ref = _PORTAL_REPORT_OVERRIDES.get(report_ref, report_ref)
|
||||
return super()._show_report(
|
||||
model=model,
|
||||
report_type=report_type,
|
||||
report_ref=report_ref,
|
||||
download=download,
|
||||
)
|
||||
Reference in New Issue
Block a user