fix: ADP portal payment uses client portion instead of full order total

When customers pay for ADP quotations through the portal, the system
was charging the full order amount (ADP + client portions combined).
Now correctly charges only the client portion (25% for REG clients).

Changes:
- Override _get_prepayment_required_amount() to return client portion
- Override _has_to_be_paid() to skip payment for 100% ADP-funded orders
- Add portal controller to cap payment amount at client portion
- Add portal template showing ADP funding breakdown to customer
This commit is contained in:
Nexa Agent
2026-03-09 21:11:19 +00:00
parent 3b3c57205a
commit 35399170b3
6 changed files with 698 additions and 296 deletions

View File

@@ -4,6 +4,7 @@
# Part of the Fusion Claim Assistant product family.
from . import models
from . import controllers
from . import wizard

View File

@@ -5,7 +5,7 @@
{
'name': 'Fusion Claims',
'version': '19.0.7.0.0',
'version': '19.0.7.2.0',
'category': 'Sales',
'summary': 'Complete ADP Claims Management with Dashboard, Sales Integration, Billing Automation, and Two-Stage Verification.',
'description': """
@@ -84,6 +84,7 @@
'calendar',
'ai',
'fusion_ringcentral',
'fusion_tasks',
],
'external_dependencies': {
'python': ['pdf2image', 'PIL'],
@@ -102,6 +103,7 @@
'views/res_company_views.xml',
'views/res_config_settings_views.xml',
'views/sale_order_views.xml',
'views/sale_portal_templates.xml',
'views/account_move_views.xml',
'views/account_journal_views.xml',
'wizard/adp_export_wizard_views.xml',
@@ -128,6 +130,7 @@
'wizard/odsp_pre_approved_wizard_views.xml',
'wizard/odsp_ready_delivery_wizard_views.xml',
'wizard/ltc_repair_create_so_wizard_views.xml',
'wizard/send_page11_wizard_views.xml',
'views/res_partner_views.xml',
'views/pdf_template_inherit_views.xml',
'views/dashboard_views.xml',
@@ -140,9 +143,8 @@
'views/adp_claims_views.xml',
'views/submission_history_views.xml',
'views/fusion_loaner_views.xml',
'views/page11_sign_request_views.xml',
'views/technician_task_views.xml',
'views/task_sync_views.xml',
'views/technician_location_views.xml',
'report/report_actions.xml',
'report/report_templates.xml',
'report/sale_report_portrait.xml',
@@ -153,7 +155,8 @@
'report/report_proof_of_delivery.xml',
'report/report_proof_of_delivery_standard.xml',
'report/report_proof_of_pickup.xml',
'report/report_rental_agreement.xml',
'report/report_approved_items.xml',
'report/report_grab_bar_waiver.xml',
'report/report_accessibility_contract.xml',
'report/report_mod_quotation.xml',
@@ -167,7 +170,6 @@
'assets': {
'web.assets_backend': [
'fusion_claims/static/src/scss/fusion_claims.scss',
'fusion_claims/static/src/css/fusion_task_map_view.scss',
'fusion_claims/static/src/js/chatter_resize.js',
'fusion_claims/static/src/js/document_preview.js',
'fusion_claims/static/src/js/preview_button_widget.js',
@@ -176,10 +178,9 @@
'fusion_claims/static/src/js/tax_totals_patch.js',
'fusion_claims/static/src/js/google_address_autocomplete.js',
'fusion_claims/static/src/js/calendar_store_hours.js',
'fusion_claims/static/src/js/fusion_task_map_view.js',
'fusion_claims/static/src/js/attachment_image_compress.js',
'fusion_claims/static/src/js/debug_required_fields.js',
'fusion_claims/static/src/xml/document_preview.xml',
'fusion_claims/static/src/xml/fusion_task_map_view.xml',
],
},
'images': ['static/description/icon.png'],

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import portal

View File

@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# Copyright 2024-2025 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Claim Assistant product family.
from odoo.addons.sale.controllers.portal import CustomerPortal
class FusionCustomerPortal(CustomerPortal):
def _determine_is_down_payment(self, order_sudo, amount_selection, payment_amount):
"""Override to use client portion for ADP down-payment comparison."""
if (
hasattr(order_sudo, '_is_adp_sale')
and order_sudo._is_adp_sale()
and order_sudo.x_fc_client_type == 'REG'
):
payable = order_sudo.x_fc_client_portion_total or 0
if amount_selection == 'down_payment':
return True
elif amount_selection == 'full_amount':
return False
else:
return (
order_sudo.prepayment_percent < 1.0 if payment_amount is None
else payment_amount < payable
)
return super()._determine_is_down_payment(order_sudo, amount_selection, payment_amount)
def _get_payment_values(self, order_sudo, is_down_payment=False, payment_amount=None, **kwargs):
"""Override to cap payment amount at client portion for ADP orders."""
values = super()._get_payment_values(
order_sudo,
is_down_payment=is_down_payment,
payment_amount=payment_amount,
**kwargs,
)
if not (
hasattr(order_sudo, '_is_adp_sale')
and order_sudo._is_adp_sale()
and order_sudo.x_fc_client_type == 'REG'
):
return values
client_portion = order_sudo.x_fc_client_portion_total or 0
if client_portion <= 0:
return values
current_amount = values.get('amount', 0)
if current_amount > client_portion:
values['amount'] = order_sudo.currency_id.round(client_portion)
return values

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024-2025 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Claim Assistant product family.
Portal template overrides for ADP orders:
Shows client portion amount instead of full order total.
-->
<odoo>
<!-- Override portal content to show ADP client portion info -->
<template id="sale_order_portal_content_adp"
inherit_id="sale.sale_order_portal_content"
name="Fusion: ADP Client Portion on Portal">
<xpath expr="//div[@id='total']" position="before">
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG'">
<div class="alert alert-info mb-3 py-2">
<strong>ADP Assisted Devices Program Order</strong><br/>
This order is partially funded through ADP.<br/>
<strong>Your portion:</strong>
<span t-esc="sale_order.x_fc_client_portion_total"
t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
<span class="text-muted ms-2">
(ADP covers
<span t-esc="sale_order.x_fc_adp_portion_total"
t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>)
</span>
</div>
</t>
</xpath>
</template>
<!-- Override payment amount selector to show client portion for ADP -->
<template id="sale_order_portal_pay_amount_adp"
inherit_id="sale.sale_order_portal_pay_modal_amount_selector"
name="Fusion: ADP Payment Amount Selector">
<xpath expr="//button[@name='o_sale_portal_amount_total_button']" position="replace">
<button name="o_sale_portal_amount_total_button" class="btn btn-light">
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG'">
Client Portion <br/>
<span
t-out="sale_order.x_fc_client_portion_total"
t-options="{
'widget': 'monetary',
'display_currency': sale_order.currency_id,
}"
class="fw-bold"
/>
</t>
<t t-else="">
Full amount <br/>
<span
t-out="sale_order.amount_total"
t-options="{
'widget': 'monetary',
'display_currency': sale_order.currency_id,
}"
class="fw-bold"
/>
</t>
</button>
</xpath>
</template>
</odoo>