From a674b47980130b480f8e9bff0c1d5b0c6ac9be79 Mon Sep 17 00:00:00 2001
From: "Richard Mathot (OpenERP)"
Date: Wed, 19 Mar 2014 14:52:24 +0100
Subject: [PATCH] [FIX] Views and actions for hr_evaluation
bzr revid: rim@openerp.com-20140319135224-qxeth056mwkwciue
---
addons/hr_evaluation/hr_evaluation.py | 39 +++++++++--------
addons/hr_evaluation/hr_evaluation_view.xml | 43 +++----------------
addons/hr_recruitment/hr_recruitment_view.xml | 8 ++--
3 files changed, 32 insertions(+), 58 deletions(-)
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 4c136f49793..7d9f45f3585 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -285,7 +285,6 @@ class hr_evaluation_interview(osv.Model):
('done', "Done"),
('cancel', "Cancelled")],
string="State", required=True),
- # fields from request_id
'survey_id': fields.related('phase_id', 'survey_id', string="Appraisal Form", type="many2one", relation="survey.survey"),
'deadline': fields.related('request_id', 'deadline', type="datetime", string="Deadline"),
}
@@ -326,7 +325,10 @@ class hr_evaluation_interview(osv.Model):
return res
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'waiting_answer'}, context=context)
+ request_obj = self.pool.get('survey.user_input')
+ for interview in self.browse(cr, uid, ids, context=context):
+ request_obj.action_survey_resent(cr, uid, [interview.id], context=context)
+ self.write(cr, uid, interview.id, {'state': 'waiting_answer'}, context=context)
return True
def survey_req_done(self, cr, uid, ids, context=None):
@@ -352,20 +354,21 @@ class hr_evaluation_interview(osv.Model):
return True
def action_print_survey(self, cr, uid, ids, context=None):
- """
- If response is available then print this response otherwise print survey form(print template of the survey).
+ """ If response is available then print this response otherwise print survey form (print template of the survey) """
+ context = context if context else {}
+ interview = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_print_survey(cr, uid, [interview.survey_id.id], context=context)
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Survey IDs
- @param context: A standard dictionary for contextual values
- @return: Dictionary value for print survey form.
- """
- if context is None:
- context = {}
- record = self.browse(cr, uid, ids, context=context)
- record = record and record[0]
- context.update({'survey_id': record.survey_id.id, 'response_id': [record.response.id], 'response_no': 0})
- value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
- return value
+ def action_start_survey(self, cr, uid, ids, context=None):
+ context = context if context else {}
+ interview = self.browse(cr, uid, ids, context=context)[0]
+ survey_obj = self.pool.get('survey.survey')
+ response_obj = self.pool.get('survey.user_input')
+ # grab the token of the response and start surveying
+ response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
+ context.update({'survey_token': response.token})
+ return survey_obj.action_start_survey(cr, uid, [interview.survey_id.id], context=context)
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
index 73347f0fbe4..8f3998eeb42 100644
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ b/addons/hr_evaluation/hr_evaluation_view.xml
@@ -180,31 +180,7 @@
-
-
-
+
-
+
-
+
@@ -305,7 +276,7 @@
@@ -338,8 +309,8 @@
-
-
+
+
@@ -426,7 +397,7 @@
target="new" multi="True"
key2="client_action_multi"
context="{'default_composition_mode': 'mass_mail',
- 'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
+ 'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey'}"/>
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index a5d5ddabb0a..53e35ea58d1 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -93,7 +93,7 @@
+ attrs="{'invisible': [('emp_id', '!=', False)]}"/>
@@ -318,7 +318,7 @@
process and follow up all operations: meetings, interviews, etc.
Applicants and their attached CV are created automatically when an email is sent.
- If you install the document management modules, all resumes are indexed automatically,
+ If you install the document management modules, all resumes are indexed automatically,
so that you can easily search through their content.
- Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
+ Click here to create a new job or remove the filter on "In Recruitment" to recruit for an on hold job.
Define job position profile and manage recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe