diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 2e22a765934..780c4390a09 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -56,10 +56,6 @@ class hr_recruitment_stage(osv.osv):
'fold': fields.boolean('Folded in Kanban View',
help='This stage is folded in the kanban view when'
'there are no records in that stage to display.'),
- 'closed': fields.boolean('Closing Stage',
- help='Indicates whether this field is the end of'
- 'the maangement process. This is for example a'
- 'stage considering the applicant as hired or refused.'),
}
_defaults = {
'sequence': 1,
@@ -87,8 +83,9 @@ class hr_applicant(osv.Model):
_inherit = ['mail.thread', 'ir.needaction_mixin']
_track = {
'stage_id': {
- 'hr_recruitment.mt_applicant_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence == 1,
- 'hr_recruitment.mt_applicant_stage_changed': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence != 1,
+ # this is only an heuristics; depending on your particular stage configuration it may not match all 'new' stages
+ 'hr_recruitment.mt_applicant_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence <= 1,
+ 'hr_recruitment.mt_applicant_stage_changed': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence > 1,
},
}
@@ -99,7 +96,7 @@ class hr_applicant(osv.Model):
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
department_id = self._get_default_department_id(cr, uid, context=context)
- return self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], context=context)
+ return self.stage_find(cr, uid, [], department_id, [('fold', '=', False)], context=context)
def _resolve_department_id_from_context(self, cr, uid, context=None):
""" Returns ID of department based on the value of 'default_department_id'
@@ -246,7 +243,7 @@ class hr_applicant(osv.Model):
def onchange_department_id(self, cr, uid, ids, department_id=False, stage_id=False, context=None):
if not stage_id:
- stage_id = self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], context=context)
+ stage_id = self.stage_find(cr, uid, [], department_id, [('fold', '=', False)], context=context)
return {'value': {'stage_id': stage_id}}
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml
index 6279d88cba4..219f36405b5 100644
--- a/addons/hr_recruitment/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/hr_recruitment_data.xml
@@ -71,13 +71,12 @@
Contract Signed
5
-
+
Refused
6
-
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 912419a1874..7553a24ff3c 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -358,11 +358,10 @@
-
+
-
diff --git a/addons/hr_recruitment/report/hr_recruitment_report.py b/addons/hr_recruitment/report/hr_recruitment_report.py
index 0292875a2c7..908b701d928 100644
--- a/addons/hr_recruitment/report/hr_recruitment_report.py
+++ b/addons/hr_recruitment/report/hr_recruitment_report.py
@@ -90,7 +90,7 @@ class hr_recruitment_report(osv.Model):
(sum(salary_proposed)/count(*)) as salary_prop_avg,
sum(salary_expected) as salary_exp,
(sum(salary_expected)/count(*)) as salary_exp_avg,
- extract('epoch' from (s.date_closed-s.create_date))/(3600*24) as delay_close,
+ extract('epoch' from (s.write_date-s.create_date))/(3600*24) as delay_close,
count(*) as nbr
from hr_applicant s
group by
@@ -101,6 +101,7 @@ class hr_recruitment_report(osv.Model):
date_trunc('day',s.date_closed),
s.date_open,
s.create_date,
+ s.write_date,
s.date_closed,
s.date_last_stage_update,
s.partner_id,