[FIX] hr_recruitment: fixed onchange_department causing the stage to be resetted

bzr revid: tde@openerp.com-20130708131040-72tke0a25mes9wwp
This commit is contained in:
Thibault Delavallée
2013-07-08 15:10:40 +02:00
parent 7f2795fe16
commit f5c09b4002
2 changed files with 7 additions and 8 deletions
+6 -7
View File
@@ -230,17 +230,16 @@ class hr_applicant(osv.Model):
'stage_id': _read_group_stage_ids
}
def onchange_job(self, cr, uid, ids, job, context=None):
if job:
job_record = self.pool.get('hr.job').browse(cr, uid, job, context=context)
def onchange_job(self, cr, uid, ids, job_id=False, context=None):
if job_id:
job_record = self.pool.get('hr.job').browse(cr, uid, job_id, context=context)
if job_record and job_record.department_id:
return {'value': {'department_id': job_record.department_id.id}}
return {}
def onchange_department_id(self, cr, uid, ids, department_id=False, context=None):
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
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)
return {'value': {'stage_id': stage_id}}
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
@@ -119,7 +119,7 @@
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="job_id" on_change="onchange_job(job_id)"/>
<field name="department_id" on_change="onchange_department_id(department_id)"/>
<field name="department_id" on_change="onchange_department_id(department_id, stage_id)"/>
<label for="availability"/>
<div>
<field name="availability" class="oe_inline"/> <label string="Day(s)" class="oe_inline"/>