# -*- encoding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hr_evaluation
+import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
"update_xml" : [
"security/ir.model.access.csv",
"hr_evaluation_view.xml",
- "hr_evaluation_data.xml"],
+ "hr_evaluation_data.xml",
+ "report/evaluation_report_view.xml"],
"active": False,
"installable": True
}
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import evaluation_report
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import tools
+from osv import fields,osv
+
+
+class evaluation_report(osv.osv):
+ _name = "evaluation.report"
+ _description = "Evaluations Statistics"
+ _auto = False
+ _rec_name = 'date'
+ _columns = {
+ 'create_date': fields.datetime('Create Date', readonly=True),
+ 'deadline': fields.date("Deadline", readonly=True),
+ 'closed': fields.date("closed", readonly=True),
+ 'year': fields.char('Year', size=4, readonly=True),
+ 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
+ ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
+ 'nbr':fields.integer('# of Requests', readonly=True),
+ 'state': fields.selection([
+ ('draft','Draft'),
+ ('wait','Plan In Progress'),
+ ('progress','Final Validation'),
+ ('done','Done'),
+ ('cancel','Cancelled'),
+ ], 'State',readonly=True),
+ }
+ _order = 'create_date desc'
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'evaluation_report')
+ cr.execute("""
+ create or replace view evaluation_report as (
+ select
+ min(l.id) as id,
+ s.create_date as create_date,
+ s.employee_id,
+ s.date as deadline,
+ s.date_close as closed,
+ to_char(s.create_date, 'YYYY') as year,
+ to_char(s.create_date, 'MM') as month,
+ count(*) as nbr,
+ s.state
+ from
+ hr_evaluation_interview l
+ left join
+ hr_evaluation_evaluation s on (s.id=l.evaluation_id)
+ group by
+ s.create_date,s.state,s.employee_id,
+ s.date,s.date_close
+ )
+ """)
+evaluation_report()
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+ <record id="view_evaluation_report_tree" model="ir.ui.view">
+ <field name="name">evaluation.report.tree</field>
+ <field name="model">evaluation.report</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Evaluations Statistics">
+ <field name="create_date"/>
+ <field name="employee_id"/>
+ <field name="deadline"/>
+ <field name="closed" invisible="1"/>
+ <field name="year" invisible="1"/>
+ <field name="month" invisible="1"/>
+ <field name="nbr" sum="# of Requests"/>
+ <field name="state"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_evaluation_report_search" model="ir.ui.view">
+ <field name="name">evaluation.report.search</field>
+ <field name="model">evaluation.report</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Evaluations">
+ <filter icon="terp-hr"
+ string="This Year"
+ domain="[('year','=',time.strftime('%%Y'))]"
+ help="Evaluations of the year"/>
+ <filter icon="terp-hr"
+ string="This Month"
+ domain="[('month','=',time.strftime('%%m'))]"
+ help="Evaluations of this month"/>
+ <separator orientation="vertical"/>
+ <filter icon="terp-hr"
+ string="Deadline"
+ domain="[('deadline','=',time.strftime('%%Y/%%m/%%d'))]"/>
+ <filter icon="terp-hr"
+ string="Closed"
+ domain="[('closed','=',time.strftime('%%Y/%%m/%%d'))]"/>
+ <separator orientation="vertical"/>
+ <field name="employee_id"/>
+ <newline/>
+ <group expand="1" string="Group By..." colspan="10" col="12">
+ <filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
+ <separator orientation="vertical"/>
+ <filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
+ <separator orientation="vertical"/>
+ <filter string="Month" icon="terp-hr" context="{'group_by':'create_date'}"/>
+ <filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
+ </group>
+ </search>
+ </field>
+ </record>
+
+ <record id="action_evaluation_report_all" model="ir.actions.act_window">
+ <field name="name">Evaluations</field>
+ <field name="res_model">evaluation.report</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,graph</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="8"/>
+ <menuitem action="action_evaluation_report_all" id="menu_evaluation_report_all" parent="hr.menu_hr_reporting" sequence="3"/>
+
+</data>
+</openerp>