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

    <!-- Add Assessment button and field to Loaner Checkout form -->
    <record id="view_fusion_loaner_checkout_form_assessment" model="ir.ui.view">
        <field name="name">fusion.loaner.checkout.form.assessment</field>
        <field name="model">fusion.loaner.checkout</field>
        <field name="inherit_id" ref="fusion_loaners_management.view_fusion_loaner_checkout_form"/>
        <field name="arch" type="xml">
            <xpath expr="//button[@name='action_view_partner']" position="before">
                <button name="action_view_assessment" type="object"
                        class="oe_stat_button" icon="fa-clipboard"
                        invisible="not assessment_id">
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_text">Assessment</span>
                    </div>
                </button>
            </xpath>
            <xpath expr="//field[@name='sale_order_id']" position="after">
                <field name="assessment_id"/>
            </xpath>
        </field>
    </record>

</odoo>
