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

    <record id="res_partner_action_certifications" model="ir.actions.act_window">
        <field name="name">Certifications Succeeded</field>
        <field name="res_model">survey.user_input</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{'search_default_scoring_success': 1}</field>
    </record>

    <record id="res_partner_view_form" model="ir.ui.view">
        <field name="name">res.partner.view.form.inherit.survey</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='button_box']" position="inside">
                <button class="oe_stat_button" type="object"
                    icon="fa-trophy" name="action_view_certifications"
                     groups="survey.group_survey_user"
                    attrs="{'invisible': ['|', ('certifications_count', '=', 0), ('is_company', '=', True)]}">
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_value"><field name="certifications_count" /></span>
                        <span class="o_stat_text" attrs="{'invisible': [('certifications_count', '&lt;', 2)]}">Certifications</span>
                        <span class="o_stat_text" attrs="{'invisible': [('certifications_count', '&gt;', 1)]}">Certification</span>
                    </div>
                </button>
                <button class="oe_stat_button" type="object"
                    icon="fa-trophy" name="action_view_certifications"
                    groups="survey.group_survey_user"
                    attrs="{'invisible': ['|', ('certifications_company_count', '=', 0), ('is_company', '=', False)]}">
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_value"><field name="certifications_company_count" /></span>
                        <span class="o_stat_text" attrs="{'invisible': [('certifications_company_count', '&lt;', 2)]}">Certifications</span>
                        <span class="o_stat_text" attrs="{'invisible': [('certifications_company_count', '&gt;', 1)]}">Certification</span>
                    </div>
                </button>
            </xpath>
        </field>
    </record>

</data></odoo>
