diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index f1f09305bbe..b9aa85f8904 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -185,6 +185,14 @@ class hr_applicant(crm.crm_case, osv.osv): return {'value': result} return {'value': {'department_id': False}} + def onchange_department_id(self, cr, uid, ids, department_id=False, context=None): + if not department_id: + return {'value': {'stage_id': False}} + obj_recru_stage = self.pool.get('hr.recruitment.stage') + stage_ids = obj_recru_stage.search(cr, uid, ['|',('department_id','=',department_id),('department_id','=',False)], context=context) + stage_id = stage_ids and stage_ids[0] or False + return {'value': {'stage_id': stage_id}} + def stage_previous(self, cr, uid, ids, context=None): """This function computes previous stage for case from its current stage using available stage for that case type diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 3738a1d8be6..9988be7d368 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -80,7 +80,7 @@