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

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