<?xml version="1.0"?>
<data name="Payment on My Invoices" inherit_id="account.portal_invoice_page">
        <xpath expr="//t[@t-call='portal.portal_record_sidebar']//h2[1]" position="after">
            <t t-set="pending_txs" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized') and tx.provider_code not in ('none', 'custom'))"/>
            <div name="invoice_paid_badge" t-if="invoice.currency_id.is_zero(invoice.amount_residual)" class="rounded text-bg-success fw-normal badge">
                <i class="fa fa-fw fa-check-circle"/> Paid
            </div>
            <div t-if="invoice.payment_state == 'in_payment' and not invoice.currency_id.is_zero(invoice.amount_residual)" class="rounded text-bg-info fw-normal badge">
                <i class="fa fa-fw fa-check-circle"/> Processing Payment
            </div>
            <div t-elif="pending_txs" class="rounded text-bg-info fw-normal badge">
                <i class="fa fa-fw fa-check-circle"/> Pending
            </div>
        </xpath>
        <xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('o_download_pdf')]" position="before">
            <a t-if="invoice._has_to_be_paid()" href="#" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#pay_with">
                <i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
            </a>
        </xpath>
        <xpath expr="//div[@id='invoice_content']//div[hasclass('o_portal_html_view')]" position="before">
            <t t-set="tx" t-value="invoice.get_portal_last_transaction()"/>
            <div t-if="invoice.get_portal_last_transaction() and invoice.amount_total and not success and not error and (invoice.payment_state != 'not_paid' or tx.state in ('pending', 'authorized'))" class="o_account_payment_tx_status" t-att-data-invoice-id="invoice.id">
                <t t-call="payment.state_header"/>
            </div>
            <div t-if="invoice._has_to_be_paid()" id="portal_pay" t-att-data-payment="payment">
                <t t-call="account_payment.portal_invoice_payment"/>
            </div>
            <div t-else="" id="portal_pay" t-att-data-payment="payment">
                <t t-call="account_payment.portal_invoice_payment_paid"/>
            </div>
        </xpath>
    </data>

    