<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record id="view_hr_recruitment_report_graph" model="ir.ui.view">
         <field name="name">hr.recruitment.report.graph</field>
         <field name="model">hr.recruitment.report</field>
         <field name="arch" type="xml">
             <graph string="Recruitment Analysis" type="pivot">
                 <field name="stage_id" type="row"/>
                 <field name="job_id" type="col"/>
             </graph>
         </field>
    </record>

    <!-- Custom reports (aka filters) -->
    <record id="filter_recruitment_report_recruiter" model="ir.filters">
        <field name="name">By Recruiter</field>
        <field name="model_id">hr.recruitment.report</field>
        <field name="user_id" eval="False"/>
        <field name="context">{'group_by': ['date_create:month', 'user_id'], 'col_group_by': ['date_create:month']}</field>
    </record>
    <record id="filter_recruitment_report_job" model="ir.filters">
        <field name="name">By Job</field>
        <field name="model_id">hr.recruitment.report</field>
        <field name="user_id" eval="False"/>
        <field name="context">{'group_by': ['date_create:month', 'job_id'], 'col_group_by': ['date_create:month']}</field>
    </record>
    <record id="filter_recruitment_report_departmnet" model="ir.filters">
        <field name="name">By Department</field>
        <field name="model_id">hr.recruitment.report</field>
        <field name="user_id" eval="False"/>
        <field name="context">{'group_by': ['date_create:month', 'department_id'], 'col_group_by': ['date_create:month']}</field>
    </record>

    <record id="view_hr_recruitment_report_search" model="ir.ui.view">
        <field name="name">hr.recruitment.report.search</field>
        <field name="model">hr.recruitment.report</field>
        <field name="arch" type="xml">
            <search string="Recruitment Analysis">
                <field name="job_id"/>
                <field name="department_id"/>
                <field name="user_id"/>
                <filter string="This Year" name="year" domain="[('date_create','&lt;=', time.strftime('%%Y-12-31')),('date_create','&gt;=',time.strftime('%%Y-01-01'))]"/>
                <separator/>
                <filter string="Unassigned" domain="[('user_id', '=', False)]"/>
                <filter string="My" domain="[('user_id', '=', uid)]"/>
                <separator/>
                <filter string="New" domain="[('stage_id.sequence', '=', 1)]"/>
                <separator/>
                <group expand="0" string="Extended Filters">
                    <field name="priority"/>
                    <field name="stage_id"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <field name="date_create"/>
                    <field name="date_closed"/>
                </group>
                <group expand="1" string="Group By">
                   <filter string="Responsible" name='User' context="{'group_by':'user_id'}"/>
                   <filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
                   <filter string="Jobs" name="job" context="{'group_by':'job_id'}"/>
                   <filter string="Department" name="department" context="{'group_by':'department_id'}"/>
                   <filter string="Stage" context="{'group_by':'stage_id'}" />
                   <separator/>
                   <filter string="Creation Week" context="{'group_by':'date_create:week'}" help="Creation Week"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_hr_recruitment_report_all" model="ir.actions.act_window">
        <field name="name">Recruitment Analysis</field>
        <field name="res_model">hr.recruitment.report</field>
        <field name="view_type">form</field>
        <field name="view_mode">graph</field>
        <field name="context">{'group_by_no_leaf':1,'group_by':[]}</field>
        <field name="search_view_id" ref="view_hr_recruitment_report_search"/>
    </record>
    <menuitem action="action_hr_recruitment_report_all" id="menu_hr_recruitment_report_all" parent="hr.menu_hr_reporting" sequence="0"/>

</data>
</openerp>
