diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 1f3e960fb6e..a230c55bfb7 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -300,6 +300,50 @@ class hr_evaluation_interview(osv.osv):
self.write(cr, uid, ids, { 'state' : 'cancel'}, context=context)
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).
+
+ @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 not context:
+ context = {}
+ record = self.read(cr, uid, ids, [])
+ datas = {}
+ page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
+ report = {}
+ if record:
+ datas['ids'] = [record[0]['survey_id'][0]]
+ response_id = record[0]['response']
+ if response_id:
+ context.update({'survey_id': datas['ids'], 'response_id' : [response_id[0]], 'response_no':0})
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print.answer'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.browse.response',
+ 'datas': datas,
+ 'nodestroy': True,
+ 'context' : context
+ }
+ else:
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'nodestroy':True,
+ 'context' : context
+ }
+ return report
+
+
hr_evaluation_interview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
index 4f16eb68575..fc3d1326ea6 100644
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ b/addons/hr_evaluation/hr_evaluation_view.xml
@@ -261,8 +261,8 @@
-
+
@@ -297,8 +297,8 @@
-
+
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 27767c493cb..26ac6a1396e 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -61,6 +61,50 @@ class hr_applicant(osv.osv):
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
'response' : fields.integer("Response"),
}
+
+ 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).
+
+ @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 not context:
+ context = {}
+ datas = {}
+ record = self.read(cr, uid, ids, ['survey', 'response'])
+ page_setting = {'orientation': 'vertical', 'without_pagebreak': 0, 'paper_size': 'letter', 'page_number': 1, 'survey_title': 1}
+ report = {}
+ if record:
+ datas['ids'] = [record[0]['survey'][0]]
+ response_id = record[0]['response']
+ if response_id:
+ context.update({'survey_id': datas['ids'], 'response_id' : [response_id], 'response_no':0,})
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print.answer'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.browse.response',
+ 'datas': datas,
+ 'nodestroy': True,
+ 'context' : context
+ }
+ else:
+ datas['form'] = page_setting
+ datas['model'] = 'survey.print'
+ report = {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'nodestroy':True,
+ 'context' : context
+ }
+ return report
+
hr_applicant()
class hr_job(osv.osv):
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 0d9fa7ec72d..2cabc56cd8f 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -85,8 +85,8 @@
-
+