[imp] change the condition for validate apprisal

bzr revid: tpa@tinyerp.com-20111205132102-ssw1aez82mwibriz
This commit is contained in:
Turkesh Patel (Open ERP) 2011-12-05 18:51:02 +05:30
parent 663030a591
commit 1ed48144c4
2 changed files with 7 additions and 1 deletions

View File

@ -240,7 +240,7 @@ class hr_evaluation(osv.osv):
request_obj = self.pool.get('hr.evaluation.interview')
self.write(cr, uid, ids, {'state':'progress'}, context=context)
for id in self.browse(cr, uid, ids, context=context):
if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')], context=context)):
if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', 'in', ['done','cancel'])], context=context)):
raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state"))
return True
@ -256,6 +256,10 @@ class hr_evaluation(osv.osv):
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids,{'state': 'draft'}, context=context)
return True
def write(self, cr, uid, ids, vals, context=None):
if 'date' in vals:
new_vals = {'date_deadline': vals.get('date')}

View File

@ -207,6 +207,8 @@
icon="gtk-execute"/>
<button name="button_done" string="Done" states="progress" type="object"
icon="gtk-jump-to"/>
<button name="button_draft" string="Reset to Draft" states="cancel" type="object"
icon="terp-stock_effects-object-colorize"/>
<button name="button_final_validation" string="Validate Appraisal" states="wait" type="object"
icon="gtk-go-forward"/>
</group>