<?xml version="1.0"?>
<odoo>
        <!-- Add contextual button on partner form view -->
        <record id="view_partners_form_crm1" model="ir.ui.view">
            <field name="name">view.res.partner.form.crm.inherited1</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field eval="1" name="priority"/>
            <field name="arch" type="xml">
                <data>
                    <div name="button_box" position="inside">
                        <button class="oe_stat_button o_res_partner_tip_opp" type="object"
                            name="action_view_opportunity"
                            icon="fa-star"
                            groups="sales_team.group_sale_salesman"
                            context="{'default_partner_id': id, 'default_type':'opportunity'}">
                            <field string="Opportunities" name="opportunity_count" widget="statinfo"/>
                        </button>
                    </div>
                </data>
            </field>
        </record>

</odoo>
