diff --git a/addons/hr_recruitment/board_hr_recruitment_statistical_view.xml b/addons/hr_recruitment/board_hr_recruitment_statistical_view.xml
index 79e09937705..2bec80858a5 100644
--- a/addons/hr_recruitment/board_hr_recruitment_statistical_view.xml
+++ b/addons/hr_recruitment/board_hr_recruitment_statistical_view.xml
@@ -22,7 +22,7 @@
hr.applicant
form
tree,form
- [('state','in',('draft','open'))]
+ [('stage_id.fold', '!=', True)]
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index c25583cba77..4745672179b 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -19,23 +19,13 @@
#
##############################################################################
-import time
from openerp import tools
-from openerp.addons.base_status.base_stage import base_stage
from datetime import datetime
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import html2plaintext
-AVAILABLE_STATES = [
- ('draft', 'New'),
- ('cancel', 'Refused'),
- ('open', 'In Progress'),
- ('pending', 'Pending'),
- ('done', 'Hired')
-]
-
AVAILABLE_PRIORITIES = [
('', ''),
('5', 'Not Good'),
@@ -62,13 +52,11 @@ class hr_recruitment_stage(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of stages."),
'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep this field empty."),
- 'state': fields.selection(AVAILABLE_STATES, 'Status', required=True, help="The related status for the stage. The status of your document will automatically change according to the selected stage. Example, a stage is related to the status 'Close', when your document reach this stage, it will be automatically closed."),
'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."),
'requirements': fields.text('Requirements'),
}
_defaults = {
'sequence': 1,
- 'state': 'draft',
'fold': False,
}
@@ -87,19 +75,19 @@ class hr_recruitment_degree(osv.osv):
('name_uniq', 'unique (name)', 'The name of the Degree of Recruitment must be unique!')
]
-class hr_applicant(base_stage, osv.Model):
+class hr_applicant(osv.Model):
_name = "hr.applicant"
_description = "Applicant"
_order = "id desc"
_inherit = ['mail.thread', 'ir.needaction_mixin']
_track = {
- 'state': {
- 'hr_recruitment.mt_applicant_hired': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
- 'hr_recruitment.mt_applicant_refused': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel',
- },
- 'stage_id': {
- 'hr_recruitment.mt_stage_changed': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['done', 'cancel'],
- },
+ # 'state': {
+ # 'hr_recruitment.mt_applicant_hired': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
+ # 'hr_recruitment.mt_applicant_refused': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel',
+ # },
+ # 'stage_id': {
+ # 'hr_recruitment.mt_stage_changed': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['done', 'cancel'],
+ # },
}
def _get_default_department_id(self, cr, uid, context=None):
@@ -109,7 +97,7 @@ class hr_applicant(base_stage, 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, [('state', '=', 'draft')], context=context)
+ return self.stage_find(cr, uid, [], department_id, [('sequence', '=', '1')], 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'
@@ -197,13 +185,6 @@ class hr_applicant(base_stage, 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)]"),
- 'state': fields.related('stage_id', 'state', type="selection", store=True,
- selection=AVAILABLE_STATES, string="Status", readonly=True,
- help='The status is set to \'Draft\', when a case is created.\
- If the case is in progress the status is set to \'Open\'.\
- When the case is over, the status is set to \'Done\'.\
- If the case needs to be reviewed then the status is \
- set to \'Pending\'.'),
'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'),
@@ -409,20 +390,6 @@ class hr_applicant(base_stage, osv.Model):
self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('Applicant created'), subtype="hr_recruitment.mt_job_new_applicant", context=context)
return obj_id
- def case_open(self, cr, uid, ids, context=None):
- """
- open Request of the applicant for the hr_recruitment
- """
- res = super(hr_applicant, self).case_open(cr, uid, ids, context)
- date = self.read(cr, uid, ids, ['date_open'])[0]
- if not date['date_open']:
- self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),})
- return res
-
- def case_close(self, cr, uid, ids, context=None):
- res = super(hr_applicant, self).case_close(cr, uid, ids, context)
- return res
-
def case_close_with_emp(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -454,26 +421,6 @@ class hr_applicant(base_stage, osv.Model):
dict_act_window['view_mode'] = 'form,tree'
return dict_act_window
- def case_cancel(self, cr, uid, ids, context=None):
- """Overrides cancel for crm_case for setting probability
- """
- res = super(hr_applicant, self).case_cancel(cr, uid, ids, context)
- self.write(cr, uid, ids, {'probability': 0.0})
- return res
-
- def case_pending(self, cr, uid, ids, context=None):
- """Marks case as pending"""
- res = super(hr_applicant, self).case_pending(cr, uid, ids, context)
- self.write(cr, uid, ids, {'probability': 0.0})
- return res
-
- def case_reset(self, cr, uid, ids, context=None):
- """Resets case as draft
- """
- res = super(hr_applicant, self).case_reset(cr, uid, ids, context)
- self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
- return res
-
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority
"""
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml
index f3f1b3e712d..854dea0548f 100644
--- a/addons/hr_recruitment/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/hr_recruitment_data.xml
@@ -51,34 +51,29 @@
Doctoral Degree
4
+
Initial Qualification
- draft
1
First Interview
- open
2
Second Interview
- open
3
Contract Proposed
- pending
4
Contract Signed
- done
5
Refused
- cancel
6
@@ -467,24 +462,24 @@
hr.job
-
+
+ New Applicant
+ hr.applicant
+
+ Applicant created
+
+
Stage Changed
hr.applicant
Stage changed
-
+
Applicant Hired
hr.applicant
Applicant hired
-
- Applicant Refused
- hr.applicant
-
- Applicant refused
-
Reserve
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 9cbfd4560e7..e751fd5bb04 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -39,7 +39,7 @@
Applicants
hr.applicant
-
+
@@ -58,7 +58,6 @@
-
@@ -69,11 +68,9 @@
@@ -176,14 +172,11 @@
+
+
+
-
-
-
-
-
-
@@ -342,7 +335,6 @@
-
@@ -360,7 +352,6 @@
-
diff --git a/addons/hr_recruitment/report/hr_recruitment_report.py b/addons/hr_recruitment/report/hr_recruitment_report.py
index 8c365b10070..b733655e51e 100644
--- a/addons/hr_recruitment/report/hr_recruitment_report.py
+++ b/addons/hr_recruitment/report/hr_recruitment_report.py
@@ -18,20 +18,13 @@
# along with this program. If not, see .
#
##############################################################################
+
from openerp import tools
-from openerp.osv import fields,osv
+from openerp.osv import fields, osv
from .. import hr_recruitment
from openerp.addons.decimal_precision import decimal_precision as dp
-AVAILABLE_STATES = [
- ('draft','New'),
- ('open','Open'),
- ('cancel', 'Refused'),
- ('done', 'Hired'),
- ('pending','Pending')
-]
-
class hr_recruitment_report(osv.osv):
_name = "hr.recruitment.report"
_description = "Recruitments Statistics"
@@ -41,7 +34,7 @@ class hr_recruitment_report(osv.osv):
_columns = {
'user_id': fields.many2one('res.users', 'User', readonly=True),
'nbr': fields.integer('# of Applications', readonly=True),
- 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
+ # TDE TODO: use MONTHS
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@@ -79,7 +72,6 @@ class hr_recruitment_report(osv.osv):
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
- s.state,
s.partner_id,
s.company_id,
s.user_id,
@@ -105,7 +97,6 @@ class hr_recruitment_report(osv.osv):
s.date_open,
s.create_date,
s.date_closed,
- s.state,
s.partner_id,
s.company_id,
s.user_id,
diff --git a/addons/hr_recruitment/report/hr_recruitment_report_view.xml b/addons/hr_recruitment/report/hr_recruitment_report_view.xml
index b33b2eaa053..1845a97014e 100644
--- a/addons/hr_recruitment/report/hr_recruitment_report_view.xml
+++ b/addons/hr_recruitment/report/hr_recruitment_report_view.xml
@@ -14,7 +14,6 @@
-
@@ -46,17 +45,15 @@
hr.recruitment.report
-
-
-
-
-
-
-
+
+
+
+
+
+
-
diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml
index 335edc71892..0a6d5426e0d 100644
--- a/addons/hr_recruitment/test/recruitment_process.yml
+++ b/addons/hr_recruitment/test/recruitment_process.yml
@@ -17,33 +17,8 @@
resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.pdf'),('res_model','=',self._name),('res_id','=',applicant.id)])
assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match."
assert applicant.stage_id.id == ref('hr_recruitment.stage_job1'), "Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name)
- assert applicant.state == "draft", "Applicant state should be 'draft'."
+ assert applicant.stage_id.sequence == 1, "Applicant stage sequence should be 1."
assert len(resume_ids), "Resume is not attached."
--
- I refuse the applicant (hr_case_programmer)
--
- !python {model: hr.applicant}: |
- self.case_cancel(cr, uid, [ref("hr_case_programmer")])
--
- I check the details of the refused applicant.
--
- !python {model: hr.applicant}: |
- applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
- assert applicant.stage_id.id == ref('hr_recruitment.stage_job6'), "Stage should be 'Refused' and is %s." % (applicant.stage_id.name)
- assert applicant.state == 'cancel', "Applicant is not in 'cancel' state."
--
- I reset and re-open the previously refused applicant.
--
- !python {model: hr.applicant}: |
- self.case_reset(cr, uid, [ref("hr_case_programmer")])
- self.case_open(cr, uid, [ref("hr_case_programmer")])
--
- I check the details of the re-opened applicant.
--
- !python {model: hr.applicant}: |
- applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context)
- assert applicant.stage_id.id == ref('hr_recruitment.stage_job2'), "Stage should be 'First interview' and is '%s'." % (applicant.stage_id.name)
- assert applicant.state == "open", "Applicant state should be 'open'."
-
I assign the Job position to the applicant
-
@@ -54,21 +29,6 @@
-
!python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
--
- I check Initial Qualification of applicant.
--
- !python {model: hr.applicant}: |
- self.stage_next(cr, uid, [ref('hr_case_programmer')])
--
- I schedule First Interview of applicant.
--
- !python {model: hr.applicant}: |
- self.stage_next(cr, uid, [ref('hr_case_programmer')])
--
- On a successful First Interview of applicant, I schedule Second Interview.
--
- !python {model: hr.applicant}: |
- self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
Applicant fillup the answer of the interview quetion.
-
@@ -84,39 +44,19 @@
-
!python {model: hr.applicant}: |
self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
--
- On a successful Second Interview of applicant Contract is Proposed to applicant.
--
- !python {model: hr.applicant}: |
- self.stage_next(cr, uid, [ref('hr_case_programmer')])
- self.stage_previous(cr, uid, [ref('hr_case_programmer')])
--
- I Hired Applicant.
--
- !python {model: hr.applicant}: |
- self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
--
- I check that applicant is "Hired".
--
- !assert {model: hr.applicant, id: hr_case_programmer, string: Applicant state is done}:
- - state == 'done'
-
I do not give employment to the hired the applicant.
-
!python {model: hired.employee}: |
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_id = self.create(cr, uid, {}, context=context)
- self.case_close(cr, uid, [emp_id], context=context)
-
Now I give employment to hired applicant .
-
!python {model: hr.applicant}: |
hired_emp_obj = self.pool.get('hired.employee')
- self.case_reset(cr, uid, [ref("hr_case_programmer")])
- self.case_open(cr, uid, [ref("hr_case_programmer")])
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
- hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
-
Now hired employee want to be a partner of company.
-