feat: View Details uses ADP landscape report for ADP orders, add route decorators

This commit is contained in:
2026-03-09 22:55:53 +00:00
parent 85367747a6
commit 1bfa50aa5f

View File

@@ -5,7 +5,7 @@
import binascii
from odoo import fields, _
from odoo import fields, http, _
from odoo.exceptions import AccessError, MissingError
from odoo.http import request
from odoo.addons.sale.controllers.portal import CustomerPortal
@@ -27,6 +27,42 @@ class FusionCustomerPortal(CustomerPortal):
return order_sudo.x_fc_client_portion_total or 0
return order_sudo.amount_total
# ------------------------------------------------------------------
# View Details: render ADP landscape report for ADP orders
# ------------------------------------------------------------------
@http.route()
def portal_order_page(
self, order_id, report_type=None, access_token=None,
message=False, download=False, payment_amount=None,
amount_selection=None, **kw
):
if report_type in ('html', 'pdf', 'text'):
try:
order_sudo = self._document_check_access(
'sale.order', order_id, access_token=access_token,
)
except (AccessError, MissingError):
return request.redirect('/my')
if self._is_adp_order(order_sudo):
return self._show_report(
model=order_sudo,
report_type=report_type,
report_ref='fusion_claims.action_report_saleorder_landscape',
download=download,
)
return super().portal_order_page(
order_id,
report_type=report_type,
access_token=access_token,
message=message,
download=download,
payment_amount=payment_amount,
amount_selection=amount_selection,
**kw,
)
# ------------------------------------------------------------------
# Payment amount overrides
# ------------------------------------------------------------------
@@ -65,6 +101,7 @@ class FusionCustomerPortal(CustomerPortal):
# ------------------------------------------------------------------
# Signature: attach ADP report instead of default Odoo quotation
# ------------------------------------------------------------------
@http.route()
def portal_quote_accept(self, order_id, access_token=None, name=None, signature=None):
access_token = access_token or request.httprequest.args.get('access_token')
try: