From 9495486d3f7ac9881e8178fb23481bd6d55808f1 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Wed, 1 Sep 2010 18:04:46 +0530 Subject: [PATCH] [IMP] hr_recuritment : when someone hired,according that job postion no of employee and expected employee will change bzr revid: vir@tinyerp.com-20100901123446-t9ygdjc81ockx7r4 --- addons/hr_recruitment/hr_recruitment.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 1532c036677..24914327926 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -422,10 +422,20 @@ class hr_applicant(crm.crm_case, osv.osv): @param ids: List of case's Ids @param *args: Give Tuple Value """ + employee_obj = self.pool.get('hr.employee') + job_obj = self.pool.get('hr.job') res = super(hr_applicant, self).case_close(cr, uid, ids, *args) for (id, name) in self.name_get(cr, uid, ids): message = _('Applicant ') + " '" + name + "' "+ _("is Hired.") self.log(cr, uid, id, message) + + applicant = self.browse(cr, uid, ids)[0] + if applicant['job_id'] : + emp_id = employee_obj.create(cr,uid,{'name':applicant['name'],'job_id':applicant['job_id']['id']}) + job_data = job_obj.browse(cr,uid, [applicant['job_id']['id']])[0] + expected_emp = job_data['expected_employees'] - 1 + job_obj.write(cr,uid, [applicant['job_id']['id']],{'expected_employees':expected_emp}) + return res def case_reset(self, cr, uid, ids, *args):