<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="sale_subscription_action_res_partner" model="ir.actions.act_window">
        <field name="context">{'search_default_partner_id': [active_id], 'default_partner_id': active_id}</field>
        <field name="name">Subscriptions</field>
        <field name="res_model">sale.subscription</field>
    </record>

    <record model="ir.ui.view" id="res_partner_view_inherit_sale_subscription">
        <field name="name">partner.view.button.subscriptions_count</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="priority" eval="5"/>
        <field name="groups_id" eval="[(4, ref('odex25_sale_subscription.group_sale_subscription_view'))]"/>
        <field name="arch" type="xml">
            <div name="button_box" position="inside">
                <button class="oe_stat_button" type="action" name="%(odex25_sale_subscription.sale_subscription_action_res_partner)d" icon="fa-refresh">
                    <field string="Subscriptions" name="subscription_count" widget="statinfo"/>
                </button>
            </div>
        </field>
    </record>
</odoo>
