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

    <record id="sale_order_form_view_inherit" model="ir.ui.view">
        <field name="name">sale.order.form.inherit.sale.expense</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <data>
               <xpath expr="//button[@name='action_view_invoice']" position="before">
                   <button type="action"
                       name="%(sale_expense.hr_expense_action_from_sale_order)d"
                       class="oe_stat_button"
                       icon="fa-money"
                       attrs="{'invisible': [('expense_count', '=', 0)]}">
                       <field name="expense_count" widget="statinfo" string="Expenses"/>
                   </button>
                </xpath>
            </data>
        </field>
    </record>

</odoo>
