[IMP] if interview appraisal has wait for previous phase = True then can not be answe...
authorHardik Ansodariy (OpenERP) <han@tinyerp.com>
Tue, 3 Jan 2012 11:14:58 +0000 (16:44 +0530)
committerHardik Ansodariy (OpenERP) <han@tinyerp.com>
Tue, 3 Jan 2012 11:14:58 +0000 (16:44 +0530)
bzr revid: han@tinyerp.com-20120103111458-lk92c5n32okkkagz

addons/hr_evaluation/hr_evaluation.py
addons/survey/wizard/survey_answer.py

index 58ad9d9..ccc9a01 100644 (file)
@@ -224,6 +224,8 @@ class hr_evaluation(osv.osv):
                         wait = True
                     if not wait:
                         hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [int_id], context=context)
+                    elif wait:
+                        hr_eval_inter_obj.survey_req_draft_answer(cr, uid, [int_id], context=context)
 
                     if (not wait) and phase.mail_feature:
                         body = phase.mail_body % {'employee_name': child.name, 'user_signature': child.user_id.signature,
@@ -309,6 +311,10 @@ class hr_evaluation_interview(osv.osv):
     def survey_req_waiting_answer(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
         return True
+    
+    def survey_req_draft_answer(self, cr, uid, ids, context=None):
+        self.write(cr, uid, ids, { 'state': 'draft'}, context=context)
+        return True
 
     def survey_req_done(self, cr, uid, ids, context=None):
         hr_eval_obj = self.pool.get('hr_evaluation.evaluation')
index a4b6789..93ef932 100644 (file)
@@ -56,6 +56,7 @@ class survey_question_wiz(osv.osv_memory):
         que_col_head = self.pool.get('survey.question.column.heading')
         user_obj = self.pool.get('res.users')
         mail_message = self.pool.get('mail.message')
+        obj_module = self.pool.get('ir.module.module')
         
         if view_type in ['form']:
             wiz_id = 0
@@ -394,6 +395,11 @@ class survey_question_wiz(osv.osv_memory):
                         survey_data = survey_obj.browse(cr, uid, survey_id)
                         response_id = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))['response']
                         context.update({'response_id':response_id})
+                        module_id = obj_module.search(cr, uid, [('name', '=', 'hr_evaluation')])
+                        state = obj_module.browse(cr, uid, module_id, context=context)[0].state
+                        if state == 'installed':
+                            interview_id = context.get('active_ids',False)
+                            eval_inter_obj = self.pool.get('hr.evaluation.interview').survey_req_done(cr, uid, interview_id, context=context)
                         report = self.create_report(cr, uid, [survey_id], 'report.survey.browse.response', survey_data.title,context)
                         attachments = {}
                         file = open(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")