Files
Odoo-Modules/fusion_claims/views/sale_portal_templates.xml

222 lines
13 KiB
XML

<?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 in sidebar instead of full order total
- Displays ADP claim details (Client Type, Authorizer, Dates, etc.)
- Payment amount selector shows client portion
- Fixes confirmation text in sign and pay modals
-->
<odoo>
<!-- ================================================================
1. SIDEBAR: Show client portion instead of full amount
================================================================ -->
<template id="sale_order_portal_sidebar_adp"
inherit_id="sale.sale_order_portal_template"
name="Fusion: ADP Sidebar Amount">
<xpath expr="//div[hasclass('o_portal_sale_sidebar')]" position="attributes">
<attribute name="t-att-data-order-amount-total">
sale_order.x_fc_client_portion_total if sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG' else sale_order.amount_total
</attribute>
</xpath>
<xpath expr="//div[hasclass('o_portal_sale_sidebar')]//t[@t-set='title']" position="replace">
<t t-set="title">
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG'">
<small class="text-muted d-block">Your Portion</small>
<h2 class="mb-0 text-break">
<t t-out="sale_order.x_fc_client_portion_total"
t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
</h2>
</t>
<t t-elif="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type and sale_order.x_fc_client_type != 'REG'">
<small class="text-muted d-block">Fully ADP Funded</small>
<h2 class="mb-0 text-break text-success">$ 0.00</h2>
</t>
<t t-elif="sale_order._has_to_be_paid() and sale_order.prepayment_percent != 1.0">
<h4>Down payment</h4>
<h2>
<t t-out="sale_order._get_prepayment_required_amount()"
t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
(<t t-out="sale_order.prepayment_percent * 100"/>%)
</h2>
</t>
<h2 t-else="" t-field="sale_order.amount_total" class="mb-0 text-break"/>
</t>
</xpath>
</template>
<!-- ================================================================
2. CONTENT: Show ADP claim details + funding breakdown
================================================================ -->
<template id="sale_order_portal_content_adp"
inherit_id="sale.sale_order_portal_content"
name="Fusion: ADP Details on Portal">
<xpath expr="//div[@id='sale_info']" position="after">
<t t-if="sale_order.x_fc_is_adp_sale">
<div class="col-12 col-lg-6 mb-4">
<h5 class="mb-1">ADP Claim Details</h5>
<hr class="mt-1 mb-2"/>
<table class="table table-borderless table-sm">
<tbody style="white-space:nowrap">
<tr t-if="sale_order.x_fc_client_type">
<th class="ps-0 pb-0">Client Type:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_client_type"/></td>
</tr>
<tr t-if="sale_order.x_fc_claim_number">
<th class="ps-0 pb-0">Claim Number:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_claim_number"/></td>
</tr>
<tr t-if="sale_order.x_fc_authorizer_id">
<th class="ps-0 pb-0">Authorizer:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_authorizer_id"/></td>
</tr>
<tr t-if="sale_order.x_fc_client_ref_1">
<th class="ps-0 pb-0">Client Ref 1:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_client_ref_1"/></td>
</tr>
<tr t-if="sale_order.x_fc_client_ref_2">
<th class="ps-0 pb-0">Client Ref 2:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_client_ref_2"/></td>
</tr>
<tr t-if="sale_order.x_fc_assessment_end_date">
<th class="ps-0 pb-0">Assessment Date:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_assessment_end_date" t-options="{'widget': 'date'}"/></td>
</tr>
<tr t-if="sale_order.x_fc_claim_authorization_date">
<th class="ps-0 pb-0">Authorization Date:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_claim_authorization_date" t-options="{'widget': 'date'}"/></td>
</tr>
<tr t-if="sale_order.x_fc_claim_approval_date">
<th class="ps-0 pb-0">Approval Date:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_claim_approval_date" t-options="{'widget': 'date'}"/></td>
</tr>
<tr t-if="sale_order.x_fc_adp_delivery_date">
<th class="ps-0 pb-0">Delivery Date:</th>
<td class="w-100 pb-0 text-wrap"><span t-field="sale_order.x_fc_adp_delivery_date" t-options="{'widget': 'date'}"/></td>
</tr>
</tbody>
</table>
</div>
</t>
</xpath>
<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>
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type and sale_order.x_fc_client_type != 'REG'">
<div class="alert alert-success mb-3 py-2">
<strong>ADP Assisted Devices Program Order</strong><br/>
This order is fully funded through ADP. No payment is required from you.
</div>
</t>
</xpath>
</template>
<!-- ================================================================
3. PAYMENT MODAL: Show client portion in amount selector
================================================================ -->
<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>
<!-- ================================================================
4. PAY MODAL: Fix confirmation text for ADP orders
================================================================ -->
<template id="sale_order_portal_pay_modal_adp"
inherit_id="sale.sale_order_portal_pay_modal"
name="Fusion: ADP Pay Modal Confirmation Text">
<xpath expr="//div[hasclass('mb-3')][.//b[@data-id='total_amount']]" position="replace">
<div t-if="sale_order._has_to_be_paid()" class="mb-3">
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG'">
By paying
<span t-out="sale_order.x_fc_client_portion_total" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}" class="fw-bold"/>,
you confirm acceptance on behalf of
<b t-field="sale_order.partner_id.commercial_partner_id"/>
for quotation <b t-field="sale_order.name"/>.
This payment covers your client portion. The remaining
<span t-out="sale_order.x_fc_adp_portion_total" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}" class="fw-bold"/>
is funded by ADP.
</t>
<t t-else="">
<span t-if="sale_order.prepayment_percent and sale_order.prepayment_percent != 1.0">
<span id="o_sale_portal_use_amount_prepayment">
By paying a <u>down payment</u> of
<span t-out="amount" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}" class="fw-bold"/>
<t t-if="sale_order._get_prepayment_required_amount() == amount">(<b t-esc="sale_order.prepayment_percent * 100"/>%),</t>
</span>
<span id="o_sale_portal_use_amount_total">By paying,</span>
</span>
<span t-else="">
By paying <span t-out="amount" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}" class="fw-bold"/>,
</span>
you confirm acceptance on behalf of
<b t-field="sale_order.partner_id.commercial_partner_id"/>
for the <b data-id="total_amount" t-field="sale_order.amount_total"/> quote.
</t>
<b t-if="sale_order.payment_term_id" t-field="sale_order.payment_term_id.note" class="o_sale_payment_terms"/>
</div>
</xpath>
</template>
<!-- ================================================================
5. SIGN MODAL: Fix confirmation text for ADP orders
================================================================ -->
<template id="sale_order_portal_sign_modal_adp"
inherit_id="sale.sale_order_portal_sign_modal"
name="Fusion: ADP Sign Modal Confirmation Text">
<xpath expr="//main[@id='sign-dialog']/span[.//b[@data-id='total_amount']]" position="replace">
<span>
<t t-if="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type == 'REG'">
By signing, you confirm acceptance on behalf of
<b t-field="sale_order.partner_id.commercial_partner_id"/>
for quotation <b t-field="sale_order.name"/>.
Your client portion is
<b t-out="sale_order.x_fc_client_portion_total" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>.
The remaining
<span t-out="sale_order.x_fc_adp_portion_total" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
is funded by ADP.
</t>
<t t-elif="sale_order.x_fc_is_adp_sale and sale_order.x_fc_client_type and sale_order.x_fc_client_type != 'REG'">
By signing, you confirm acceptance on behalf of
<b t-field="sale_order.partner_id.commercial_partner_id"/>
for quotation <b t-field="sale_order.name"/>.
This order is fully funded by ADP.
</t>
<t t-else="">
By signing, you confirm acceptance on behalf of
<b t-field="sale_order.partner_id.commercial_partner_id"/>
for the <b data-id="total_amount" t-field="sale_order.amount_total"/> quote.
</t>
</span>
</xpath>
</template>
</odoo>