<?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']//div[hasclass('o_download_pdf')]" position="before">
            <t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized'))"/>
            <t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider_code in ('none', 'custom'))"/>
            <div class="d-grid">
                <a href="#" t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids or invoice.amount_paid &lt; invoice.amount_total)" class="btn btn-primary mb-2" data-bs-toggle="modal" data-bs-target="#pay_with">
                    <i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
                </a>
                <div t-if="tx_ids and not pending_manual_txs and not invoice.amount_residual and invoice.payment_state not in ('paid', 'in_payment')" class="alert alert-info py-1 mb-2">
                    <i class="fa fa-fw fa-check-circle"/> Pending
                </div>
                <div t-if="invoice.payment_state in ('paid', 'in_payment')" class="alert alert-success py-1 mb-2">
                    <i class="fa fa-fw fa-check-circle"/> Paid
                </div>
            </div>
        </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.transaction_ids 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.transaction_status"/>
            </div>
            <t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('authorized', 'done'))"/>
            <div t-if="(invoice.amount_residual or not tx_ids) and invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total" id="portal_pay">
                <t t-call="account_payment.portal_invoice_payment"/>
            </div>
            <div class="panel-body" t-if="existing_token">
                <div class="offset-lg-3 col-lg-6">
                    <i class="fa fa-info"/> You have credits card registered, you can log-in to be able to use them.
                </div>
            </div>
        </xpath>
    </data>

    