<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2018 ACSONE SA/NV.
    License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

    <record id="contract_contract_customer_form_view"
            model="ir.ui.view">
        <field name="model">contract.contract</field>
        <field name="inherit_id"
               ref="contract.contract_contract_customer_form_view"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='button_box']" position="inside">
                <button class="oe_stat_button" name="action_view_sales_orders"
                        type="object" icon="fa-edit"
                        attrs="{'invisible': [('sale_order_count', '=', 0)]}">
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_value">
                            <field name="sale_order_count"/>
                        </span>
                        <span class="o_stat_text">Sale Orders</span>
                    </div>
                </button>
            </xpath>
        </field>
    </record>

</odoo>
