if not stage_id:
return {'value':{}}
stage = self.pool.get('hr.recruitment.stage').browse(cr, uid, stage_id, context)
- if stage.state == 'done':
- context['onchange'] = True
- self.case_close_with_emp(cr, uid, ids, context)
if stage.state == "draft":
return {'value':{'active': True,'date_open': False, 'date_closed': False}}
if stage.state == "open":
'address_home_id': address_id,
'department_id': applicant.department_id.id
})
- if context.get('onchange') == True:
+ if context.get('onchange'):
return {'value':{'emp_id': emp_id,'active': True, 'date_closed': fields.datetime.now()}}
else:
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
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 stage_set(self, cr, uid, ids, stage_id, context=None):
+ if context is None:
+ context = {}
+ res = super(hr_applicant, self).stage_set(cr, uid, ids,stage_id, context)
+ stage = self.pool.get('hr.recruitment.stage').browse(cr, uid, stage_id, context)
+ if stage.state == 'done':
+ context['onchange'] = True
+ self.case_close_with_emp(cr, uid, ids, context)
+ return res
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority