[MERGE] [IMP] hr_recruitment: store current stage before doing stage modification. This allows to do some stage analysis, such as stages before refusing an applicant. Also added in reports.
bzr revid: tde@openerp.com-20130904141024-gku10b6841jwqh5y
This commit is contained in:
commit
920d50f585
|
@ -182,6 +182,8 @@ class hr_applicant(osv.Model):
|
|||
'write_date': fields.datetime('Update Date', readonly=True),
|
||||
'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage', track_visibility='onchange',
|
||||
domain="['|', ('department_id', '=', department_id), ('department_id', '=', False)]"),
|
||||
'last_stage_id': fields.many2one('hr.recruitment.stage', 'Last Stage',
|
||||
help='Stage of the applicant before being in the current stage. Used for lost cases analysis.'),
|
||||
'categ_ids': fields.many2many('hr.applicant_category', string='Tags'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', track_visibility='onchange'),
|
||||
|
@ -390,13 +392,16 @@ class hr_applicant(osv.Model):
|
|||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
# stage change: update date_last_stage_update
|
||||
if 'stage_id' in vals:
|
||||
vals['date_last_stage_update'] = fields.datetime.now()
|
||||
# user_id change: update date_start
|
||||
if vals.get('user_id'):
|
||||
vals['date_start'] = fields.datetime.now()
|
||||
|
||||
# stage_id: track last stage before update
|
||||
if 'stage_id' in vals:
|
||||
vals['date_last_stage_update'] = fields.datetime.now()
|
||||
for applicant in self.browse(cr, uid, ids, context=None):
|
||||
vals['last_stage_id'] = applicant.stage_id.id
|
||||
res = super(hr_applicant, self).write(cr, uid, [applicant.id], vals, context=context)
|
||||
return res
|
||||
return super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def create_employee_from_applicant(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Applicants" fonts="bold:message_unread==True">
|
||||
<field name="message_unread" invisible="1"/>
|
||||
<field name="last_stage_id" invisible="1"/>
|
||||
<field name="create_date"/>
|
||||
<field name="date_last_stage_update" invisible="1"/>
|
||||
<field name="name" string="Subject"/>
|
||||
|
@ -194,6 +195,7 @@
|
|||
<filter string="Degree" domain="[]" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Availability" domain="[]" context="{'group_by':'availability'}"/>
|
||||
<filter string="Appreciation" domain="[]" context="{'group_by':'priority'}"/>
|
||||
<filter string="Last Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'last_stage_id'}"/>
|
||||
<filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<filter string="Source" domain="[]" context="{'group_by':'source_id'}"/>
|
||||
<filter string="Creation Date" domain="[]" context="{'group_by':'create_date'}"/>
|
||||
|
|
|
@ -56,11 +56,12 @@ class hr_recruitment_report(osv.Model):
|
|||
'salary_prop' : fields.float("Salary Proposed", digits_compute=dp.get_precision('Account')),
|
||||
'salary_prop_avg' : fields.float("Avg. Proposed Salary", group_operator="avg", digits_compute=dp.get_precision('Account')),
|
||||
'salary_exp' : fields.float("Salary Expected", digits_compute=dp.get_precision('Account')),
|
||||
'salary_exp_avg' : fields.float("Avg. Expected Salary", group_operator="avg", digits_compute=dp.get_precision('Account')),
|
||||
'salary_exp_avg' : fields.float("Avg. Expected Salary", group_operator="avg", digits_compute=dp.get_precision('Account')),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner',readonly=True),
|
||||
'available': fields.float("Availability"),
|
||||
'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg",
|
||||
help="Number of Days to close the project issue"),
|
||||
'last_stage_id': fields.many2one ('hr.recruitment.stage', 'Last Stage'),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -84,6 +85,7 @@ class hr_recruitment_report(osv.Model):
|
|||
s.department_id,
|
||||
s.priority,
|
||||
s.stage_id,
|
||||
s.last_stage_id,
|
||||
sum(salary_proposed) as salary_prop,
|
||||
(sum(salary_proposed)/count(*)) as salary_prop_avg,
|
||||
sum(salary_expected) as salary_exp,
|
||||
|
@ -105,6 +107,7 @@ class hr_recruitment_report(osv.Model):
|
|||
s.company_id,
|
||||
s.user_id,
|
||||
s.stage_id,
|
||||
s.last_stage_id,
|
||||
s.type_id,
|
||||
s.priority,
|
||||
s.job_id,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<field name="user_id" invisible="1"/>
|
||||
<field name="job_id"/>
|
||||
<field name="stage_id" invisible="1" />
|
||||
<field name="last_stage_id" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
|
@ -68,6 +69,7 @@
|
|||
<filter string="Jobs" name="job" context="{'group_by':'job_id'}"/>
|
||||
<filter string="Department" name="department" context="{'group_by':'department_id'}"/>
|
||||
<filter string="Degree" name="degree" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Last Stage" help="Match this group by with a specific stage filter in order to analyse the recruitment process" context="{'group_by':'last_stage_id'}"/>
|
||||
<filter string="Stage" context="{'group_by':'stage_id'}" />
|
||||
<filter string="Last Stage Update" context="{'group_by':'date_last_stage_update'}" />
|
||||
<filter string="Day" name="day" context="{'group_by':'day'}" help="Creation Date"/>
|
||||
|
|
Loading…
Reference in New Issue