<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="hr_employee_certification_report_view_pivot" model="ir.ui.view">
        <field name="model">hr.employee.certification.report</field>
        <field name="arch" type="xml">
            <pivot disable_linking="True">
                <field name="employee_id" type="row"/>
                <field name="skill_type_id" type="col"/>
                <field name="skill_id" type="col"/>
                <field name="level_progress" type="measure" widget="percentage" string="Current Level"/>
            </pivot>
        </field>
    </record>

    <record id="hr_employee_certification_report_view_list" model="ir.ui.view">
        <field name="model">hr.employee.certification.report</field>
        <field name="arch" type="xml">
            <list expand="0" edit="1" editable="bottom">
                <field name="employee_id" widget="many2one_avatar_employee" options="{'no_create': True, 'no_open': True}"/>
                <field name="skill_type_id" options="{'no_create': True, 'no_open': True}" string="Certification Type"/>
                <field name="skill_id" options="{'no_create': True, 'no_open': True}" string="Certification"/>
                <field name="skill_level" options="{'no_create': True, 'no_open': True}" string="Certification Level"/>
                <field name="level_progress" widget="percentage" options="{'no_create': True, 'no_open': True}" string="Current Level"/>
            </list>
        </field>
    </record>

    <record id="hr_employee_certification_report_view_search" model="ir.ui.view">
        <field name="model">hr.employee.certification.report</field>
        <field name="arch" type="xml">
            <search>
                <field name="employee_id"/>
                <field name="department_id"/>
                <field name="skill_id" string="Certification"/>
                <field name="skill_type_id" string="Certification Type"/>
                <separator/>
                <filter string="Expired Certification" name="archived" domain="[('active', '=', False)]"/>
                <separator/>
                <filter string="Employee" name="employee" context="{'group_by': 'employee_id'}"/>
                <filter string="Department" name="department" context="{'group_by': 'department_id'}"/>
                <separator/>
                <filter string="Certification Type" name="skill_type" context="{'group_by': 'skill_type_id'}"/>
                <filter string="Certification" name="skill" context="{'group_by': 'skill_id'}"/>
            </search>
        </field>
    </record>

    <record id="hr_employee_certification_report_action" model="ir.actions.act_window">
        <field name="name">Certification</field>
        <field name="res_model">hr.employee.certification.report</field>
        <field name="search_view_id" ref="hr_employee_certification_report_view_search"/>
        <field name="view_mode">list,pivot</field>
        <field name="context">{
            'search_default_employee': 1,
        }</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_empty_folder">
            </p><p>
                This report will give you an overview of the certification per Employee.
                Create them in configuration and add them on the Employee.
            </p>
        </field>
    </record>

    <menuitem
        id="hr_employee_certification_report_menu"
        name="Certifications"
        action="hr_employee_certification_report_action"
        parent="hr_skills.hr_employee_skill_report_menu"
        sequence="25"/>
</odoo>
