[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
This commit is contained in:
parent
2cf358a198
commit
6fce971a50
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue