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

    <record id="view_evaluation_report_tree" model="ir.ui.view">
        <field name="name">hr.evaluation.report.tree</field>
        <field name="model">hr.evaluation.report</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree colors="blue:state in ('draft');black:state in ('wait','progress');gray:state in('done','cancel')"
             string="Evaluations Analysis">
                <field name="create_date" invisible="1"/>
                <field name="employee_id" invisible="1"/>
                <field name="deadline" invisible="1"/>
                <field name="closed" invisible="1"/>
                <field name="day" invisible="1"/>
                <field name="plan_id" invisible="1"/>
                <field name="year" invisible="1"/>
                <field name="month" invisible="1"/>
                <field name="rating" invisible="1"/>
                <field name="nbr" sum="# of Requests"/>
                <field name="progress_bar" widget="progressbar"/>
                <field name="delay_date"/>
                <field name="overpass_delay"/>
                <field name="state" invisible="1"/>
            </tree>
        </field>
    </record>

    <record id="view_evaluation_report_graph" model="ir.ui.view">
            <field name="name">hr.evaluation.report.graph</field>
            <field name="model">hr.evaluation.report</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
            <graph string="Evaluations Analysis" type="bar">
                 <field name="employee_id"/>
                 <field name="nbr" operator="+"/>
                 <field name="state" group="True"/>
             </graph>
         </field>
    </record>

    <record id="view_evaluation_report_search" model="ir.ui.view">
        <field name="name">hr.evaluation.report.search</field>
        <field name="model">hr.evaluation.report</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Evaluations Analysis">
            	<group>
            		<filter icon="terp-go-year" string=" Year "
                    	domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]" help="Evaluation done in current year"/>
                    <filter icon="terp-go-month" string=" Month " name="month" domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]" help="Evaluation done in current month"/>
	                <filter icon="terp-go-month" string="    Month-1    " separator="1"
                        domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Evaluation done in last month"/>
                    <separator orientation="vertical"/>
	                <filter string="In Progress" icon="terp-camera_test" domain="[('state', '=' ,'wait')]"
	                	help = "In progress Evaluations"/>
                   	<filter string="Final Validation" icon="terp-check" domain="[('state','=','progress')]"
                   		help = "Final Validation Evaluations"/>
                   	<filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
  					<separator orientation="vertical"/>
	                <field name="employee_id"/>
	                <field name="plan_id" widget="selection"/>
                </group>
                <newline/>
				<group expand="0" string="Extended Filters..." groups="base.group_extended">
                    <field name="rating"/>
                    <newline/>
                    <field name="deadline"/>
                    <separator orientation="vertical"/>
                    <field name="state"/>
                </group>
                <newline/>
                <group expand="1" string="Group By...">
                    <filter string="Employee" name="employee" icon="terp-personal" context="{'group_by':'employee_id'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Plan" icon="terp-stock_align_left_24" context="{'group_by':'plan_id'}"/>
                    <filter string="Appreciation" icon="terp-rating-rated" context="{'group_by':'rating'}"/>
                    <separator orientation="vertical"/>
                    <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
                    <separator orientation="vertical"/>
                    <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by create Date"/>
                    <filter string="Month" icon="terp-go-month" context="{'group_by':'create_date'}" help="Group by month of create Date"/>
                    <filter string="Year" icon="terp-go-month" context="{'group_by':'year'}" help="Group by year of create Date"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_evaluation_report_all" model="ir.actions.act_window">
        <field name="name">Evaluations Analysis</field>
        <field name="res_model">hr.evaluation.report</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,graph</field>
        <field name="context">{'search_default_month':1,'search_default_employee':1,'group_by_no_leaf':1,'group_by':[]}</field>
        <field name="search_view_id" ref="view_evaluation_report_search"/>
    </record>

    <menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="10"/>
    <menuitem action="action_evaluation_report_all" id="menu_evaluation_report_all" parent="hr.menu_hr_reporting" sequence="3"/>

    </data>
</openerp>
