From: Sanjay Gohel (Open ERP) Date: Mon, 30 Jul 2012 13:19:47 +0000 (+0530) Subject: [IMP]improve code remove method from onchange_stage_id X-Git-Tag: 7.0-server~2562^2~4^2 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=b2b8d07f140cc975dab19a02e04d353e936958b7;p=odoo%2Fodoo.git [IMP]improve code remove method from onchange_stage_id bzr revid: sgo@tinyerp.com-20120730131947-6xf23v00o3wdb7tc --- diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 844357e..25416bd 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -249,9 +249,6 @@ class hr_applicant(base_stage, osv.Model): 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": @@ -463,6 +460,16 @@ class hr_applicant(base_stage, osv.Model): 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