summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYsa (Open ERP) <ysa@tinyerp.co.in>2010-04-07 19:16:01 +0530
committerYsa (Open ERP) <ysa@tinyerp.co.in>2010-04-07 19:16:01 +0530
commit6fce971a50307e836a7b51ee0f458edd2c19de26 (patch)
treeb90b27d30f7f8008c54a7c0570d61bb700bf78fe
parent2cf358a19842b64dd96064a312c67e9fcc669201 (diff)
[IMP] hr_evulation, hr_recruitment :- user not give answer then print survey form other wise print survey answer
bzr revid: ysa@tinyerp.co.in-20100407134601-epyuibon3r98x81q
-rw-r--r--addons/hr_evaluation/hr_evaluation.py44
-rw-r--r--addons/hr_evaluation/hr_evaluation_view.xml8
-rw-r--r--addons/hr_recruitment/hr_recruitment.py44
-rw-r--r--addons/hr_recruitment/hr_recruitment_view.xml4
4 files changed, 94 insertions, 6 deletions
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 @@
<group colspan="1">
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
- <button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done"
- icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
+ <button name="action_print_survey" string="Print Interview" type="object" states="waiting_answer,done,cancel"
+ icon="gtk-print" attrs="{'readonly':[('survey_id','=',False)]}" />
</group>
</group>
<group col="4" colspan="4">
@@ -297,8 +297,8 @@
<field name="response" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
- <button name="%(survey.survey_browse_response)d" string="Print Interview" type="action" states="done"
- icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0}" attrs="{'readonly':[('response','=',False)]}" />
+ <button name="action_print_survey" string="Print Interview" type="object" states="waiting_answer,done,cancel"
+ icon="gtk-print" attrs="{'readonly':[('survey_id','=',False)]}"/>
<field name="state"/>
</tree>
</field>
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 @@
<field name="job_id"/>
<field name="department_id" widget="selection"/>
<button name="%(wizard_hr_job_meeting_set)d" string="Schedule Meeting" icon="terp-hr" type="action"/>
- <button name="%(survey.survey_browse_response)d" string="Print Interview" type="action"
- icon="gtk-print" context="{'survey_id': survey, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response','=',False)]}" />
+ <button name="action_print_survey" string="Print Interview" type="object"
+ icon="gtk-print" attrs="{'readonly':[('survey','=',False)]}"/>
</group>
<notebook colspan="4">
<page string="Job Info">