2010-03-16 10:52:10 +00:00
|
|
|
# -*- 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/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-01-20 12:17:53 +00:00
|
|
|
import tools
|
2010-03-16 10:52:10 +00:00
|
|
|
from osv import fields,osv
|
2010-03-17 14:38:14 +00:00
|
|
|
from hr_recruitment import hr_recruitment
|
2010-03-16 10:52:10 +00:00
|
|
|
|
|
|
|
class hr_recruitment_report(osv.osv):
|
|
|
|
_name = "hr.recruitment.report"
|
|
|
|
_description = "Recruitments Statistics"
|
|
|
|
_inherit = "crm.case.report"
|
|
|
|
_auto = False
|
|
|
|
_rec_name = 'date'
|
|
|
|
_columns = {
|
2010-04-14 06:38:43 +00:00
|
|
|
'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),
|
2010-04-21 07:25:00 +00:00
|
|
|
'day': fields.char('Day', size=128, readonly=True),
|
2010-04-15 10:54:31 +00:00
|
|
|
'date': fields.date('Date', readonly=True),
|
2010-04-21 07:25:00 +00:00
|
|
|
'date_closed': fields.date('Closed', readonly=True),
|
2010-03-16 10:52:10 +00:00
|
|
|
'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True),
|
|
|
|
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]",readonly=True),
|
|
|
|
'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
|
|
|
|
'department_id':fields.many2one('hr.department','Department',readonly=True),
|
2010-03-17 14:38:14 +00:00
|
|
|
'priority': fields.selection(hr_recruitment.AVAILABLE_PRIORITIES, 'Appreciation'),
|
2010-04-16 09:31:36 +00:00
|
|
|
'salary_prop' : fields.float("Salary Proposed"),
|
2010-04-19 11:23:35 +00:00
|
|
|
'salary_exp' : fields.float("Salary Expected"),
|
|
|
|
'available' : fields.float("Availability")
|
2010-03-16 10:52:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
_order = 'date desc'
|
|
|
|
def init(self, cr):
|
|
|
|
tools.drop_view_if_exists(cr, 'hr_recruitment_report')
|
|
|
|
cr.execute("""
|
|
|
|
create or replace view hr_recruitment_report as (
|
|
|
|
select
|
|
|
|
min(s.id) as id,
|
2010-04-19 11:23:35 +00:00
|
|
|
date_trunc('day',s.create_date) as date,
|
2010-04-12 09:17:10 +00:00
|
|
|
date_trunc('day',s.date_closed) as date_closed,
|
2010-04-19 11:23:35 +00:00
|
|
|
to_char(s.create_date, 'YYYY') as year,
|
|
|
|
to_char(s.create_date, 'MM') as month,
|
2010-04-21 07:25:00 +00:00
|
|
|
to_char(s.create_date, 'YYYY-MM-DD') as day,
|
2010-03-16 10:52:10 +00:00
|
|
|
s.state,
|
|
|
|
s.company_id,
|
|
|
|
s.user_id,
|
|
|
|
s.job_id,
|
|
|
|
s.type_id,
|
2010-04-19 11:23:35 +00:00
|
|
|
sum(s.availability) as available,
|
2010-03-16 10:52:10 +00:00
|
|
|
s.department_id,
|
|
|
|
s.priority,
|
2010-03-16 13:34:49 +00:00
|
|
|
s.stage_id,
|
2010-04-16 09:31:36 +00:00
|
|
|
sum(salary_proposed) as salary_prop,
|
|
|
|
sum(salary_expected) as salary_exp,
|
2010-03-16 13:34:49 +00:00
|
|
|
count(*) as nbr
|
2010-03-16 10:52:10 +00:00
|
|
|
from hr_applicant s
|
|
|
|
group by
|
2010-04-19 11:23:35 +00:00
|
|
|
to_char(s.create_date, 'YYYY'),
|
|
|
|
to_char(s.create_date, 'MM'),
|
2010-04-21 07:25:00 +00:00
|
|
|
to_char(s.create_date, 'YYYY-MM-DD') ,
|
2010-04-19 11:23:35 +00:00
|
|
|
date_trunc('day',s.create_date),
|
2010-04-12 09:17:10 +00:00
|
|
|
date_trunc('day',s.date_closed),
|
2010-04-12 05:42:17 +00:00
|
|
|
s.state,
|
|
|
|
s.company_id,
|
|
|
|
s.user_id,
|
|
|
|
s.stage_id,
|
|
|
|
s.type_id,
|
|
|
|
s.priority,
|
|
|
|
s.job_id,
|
|
|
|
s.department_id
|
2010-03-16 10:52:10 +00:00
|
|
|
)
|
|
|
|
""")
|
|
|
|
hr_recruitment_report()
|
2010-01-20 12:17:53 +00:00
|
|
|
|