<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="payment_transaction_form_inherit_clover" model="ir.ui.view">
        <field name="name">payment.transaction.form.inherit.clover</field>
        <field name="model">payment.transaction</field>
        <field name="inherit_id" ref="payment.payment_transaction_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='provider_reference']" position="after">
                <field name="clover_charge_id"
                       invisible="provider_code != 'clover'"
                       readonly="1"/>
                <field name="clover_refund_id"
                       invisible="provider_code != 'clover' or not clover_refund_id"
                       readonly="1"/>
                <field name="clover_order_id"
                       invisible="provider_code != 'clover' or not clover_order_id"
                       readonly="1"/>
                <field name="clover_voided"
                       invisible="provider_code != 'clover' or not clover_voided"
                       readonly="1"/>
                <field name="clover_void_date"
                       invisible="provider_code != 'clover' or not clover_voided"
                       readonly="1"/>
            </xpath>
            <!-- Void button on Clover transactions -->
            <xpath expr="//header" position="inside">
                <button name="action_clover_void"
                        string="Void Transaction"
                        type="object"
                        class="btn-danger"
                        icon="fa-ban"
                        invisible="provider_code != 'clover' or state != 'done' or clover_voided"
                        confirm="Are you sure you want to void this transaction? This cannot be undone."
                        groups="fusion_clover.group_fusion_clover_admin"/>
            </xpath>
        </field>
    </record>

</odoo>
