[FIX] Views and actions for hr_evaluation

bzr revid: rim@openerp.com-20140319135224-qxeth056mwkwciue
This commit is contained in:
Richard Mathot (OpenERP) 2014-03-19 14:52:24 +01:00
parent 1e3e03b4e6
commit a674b47980
3 changed files with 32 additions and 58 deletions

View File

@ -285,7 +285,6 @@ class hr_evaluation_interview(osv.Model):
('done', "Done"), ('done', "Done"),
('cancel', "Cancelled")], ('cancel', "Cancelled")],
string="State", required=True), string="State", required=True),
# fields from request_id
'survey_id': fields.related('phase_id', 'survey_id', string="Appraisal Form", type="many2one", relation="survey.survey"), '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"), 'deadline': fields.related('request_id', 'deadline', type="datetime", string="Deadline"),
} }
@ -326,7 +325,10 @@ class hr_evaluation_interview(osv.Model):
return res return res
def survey_req_waiting_answer(self, cr, uid, ids, context=None): 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 return True
def survey_req_done(self, cr, uid, ids, context=None): def survey_req_done(self, cr, uid, ids, context=None):
@ -352,20 +354,21 @@ class hr_evaluation_interview(osv.Model):
return True return True
def action_print_survey(self, cr, uid, ids, context=None): 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 def action_start_survey(self, cr, uid, ids, context=None):
@param cr: the current row, from the database cursor, context = context if context else {}
@param uid: the current users ID for security checks, interview = self.browse(cr, uid, ids, context=context)[0]
@param ids: List of Survey IDs survey_obj = self.pool.get('survey.survey')
@param context: A standard dictionary for contextual values response_obj = self.pool.get('survey.user_input')
@return: Dictionary value for print survey form. # grab the token of the response and start surveying
""" response = response_obj.browse(cr, uid, interview.request_id.id, context=context)
if context is None: context.update({'survey_token': response.token})
context = {} return survey_obj.action_start_survey(cr, uid, [interview.survey_id.id], context=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

View File

@ -180,31 +180,7 @@
</group> </group>
</group> </group>
<group string="Appraisal Forms" attrs="{'invisible':[('state','=','draft')]}"> <group string="Appraisal Forms" attrs="{'invisible':[('state','=','draft')]}">
<field nolabel="1" name="survey_request_ids" attrs="{'readonly': [('state', '=', 'done')]}"> <field nolabel="1" name="survey_request_ids" attrs="{'readonly': [('state', '=', 'done')]}" />
<form string="Interview Appraisal" version="7.0">
<div class="oe_right oe_button_box">
<button string="Answer Survey" states="waiting_answer" 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 string="Print Interview" states="done" icon="gtk-print" context="{'survey_id': survey_id, 'response_id' : [response], 'response_no':0,}" attrs="{'readonly':[('response_id','=',False)]}" />
</div>
<group>
<group>
<field name="survey_id" domain="[('res_model','=','hr_evaluation')]"/>
<field name="user_to_review_id"/>
<field name="user_id" string="Interviewer" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_manager']}"/>
</group>
<group>
<field name="deadline"/>
<field name="request_id" readonly="1"/>
</group>
</group>
<group col="4" string="Status" invisible="1">
<field name="state"/>
<div>
<button string="Done" name="survey_req_done" states="waiting_answer" type="object" icon="gtk-jump-to" />
</div>
</group>
</form>
</field>
</group> </group>
<group string="Internal Notes" attrs="{'invisible':[('state','=','draft')]}"> <group string="Internal Notes" attrs="{'invisible':[('state','=','draft')]}">
<field nolabel="1" name="note_action" <field nolabel="1" name="note_action"
@ -288,15 +264,10 @@
<header> <header>
<button string="Cancel Survey" name="survey_req_cancel" type="object" <button string="Cancel Survey" name="survey_req_cancel" type="object"
states="draft,waiting_answer" class="oe_left"/> states="draft,waiting_answer" class="oe_left"/>
<button string="Print Survey" name="action_print_survey" type="object" <button string="Print Survey" name="action_print_survey" type="object" states='waiting_answer,done' attrs="{'readonly':[('survey_id','=',False)]}"/>
states="draft" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}"
attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
<button string="Send Request" name="survey_req_waiting_answer" type="object" <button string="Send Request" name="survey_req_waiting_answer" type="object"
states="draft" class="oe_highlight"/> states="draft" class="oe_highlight"/>
<button string="Answer Survey" name="#" type="action" <button string="Answer Survey" class="oe_highlight" name="action_start_survey" type="object" states='waiting_answer' attrs="{'readonly':[('request_id','=',False)]}"/>
states="waiting_answer" class="oe_highlight"
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 string="Done" name="survey_req_done" type="object" <button string="Done" name="survey_req_done" type="object"
states="waiting_answer"/> states="waiting_answer"/>
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/> <field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
@ -305,7 +276,7 @@
<div class="oe_right oe_button_box" name="button_box"> <div class="oe_right oe_button_box" name="button_box">
<button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" type="action" <button string="Send Reminder Email" name="%(mail.action_email_compose_message_wizard)d" type="action"
states="waiting_answer" states="waiting_answer"
context="{'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks', context="{'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
'default_subject': 'Reminder to fill up Survey' }"/> 'default_subject': 'Reminder to fill up Survey' }"/>
</div> </div>
<group> <group>
@ -338,8 +309,8 @@
<field name="user_id" string="Interviewer"/> <field name="user_id" string="Interviewer"/>
<field name="user_to_review_id"/> <field name="user_to_review_id"/>
<field name="request_id" readonly="1" invisible="True"/> <field name="request_id" readonly="1" invisible="True"/>
<button name="#" string="Answer Survey" type="action" states="waiting_answer" 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="action_start_survey" string="Answer Survey" type="object" icon="gtk-execute" attrs="{'readonly':[('request_id','=',False)]}"/>
<button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0}" attrs="{'readonly':[('survey_id','=',False)]}"/> <button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" attrs="{'readonly':[('survey_id','=',False)]}"/>
<button name="%(mail.action_email_compose_message_wizard)d" string="Send Reminder Email" icon="terp-mail-message-new" type="action" states="waiting_answer"/> <button name="%(mail.action_email_compose_message_wizard)d" string="Send Reminder Email" icon="terp-mail-message-new" type="action" states="waiting_answer"/>
<field name="state"/> <field name="state"/>
<button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" /> <button string="Send Request" name="survey_req_waiting_answer" states="draft" type="object" icon="gtk-yes" />
@ -426,7 +397,7 @@
target="new" multi="True" target="new" multi="True"
key2="client_action_multi" key2="client_action_multi"
context="{'default_composition_mode': 'mass_mail', 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'}"/> 'default_subject': 'Reminder to fill up Survey'}"/>
</data> </data>

View File

@ -93,7 +93,7 @@
<field name="partner_name" class="oe_inline"/> <field name="partner_name" class="oe_inline"/>
<button string="Create Employee" name="create_employee_from_applicant" type="object" <button string="Create Employee" name="create_employee_from_applicant" type="object"
class="oe_link oe_inline" style="margin-left: 8px;" class="oe_link oe_inline" style="margin-left: 8px;"
attrs="{'invisible': [('emp_id', '!=', False)]}"/> attrs="{'invisible': [('emp_id', '!=', False)]}"/>
</h2> </h2>
</div> </div>
<group> <group>
@ -318,7 +318,7 @@
process and follow up all operations: meetings, interviews, etc. process and follow up all operations: meetings, interviews, etc.
</p><p> </p><p>
Applicants and their attached CV are created automatically when an email is sent. 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. so that you can easily search through their content.
</p> </p>
</field> </field>
@ -425,7 +425,7 @@
<div class="oe_job_alias oe_kanban_ellipsis" t-if=" record.alias_id.value and record.state.raw_value == 'recruit'"> <div class="oe_job_alias oe_kanban_ellipsis" t-if=" record.alias_id.value and record.state.raw_value == 'recruit'">
<span class="oe_e">%%</span><small><field name="alias_id"/></small> <span class="oe_e">%%</span><small><field name="alias_id"/></small>
</div> </div>
</div> </div>
<t t-if="record.state.raw_value == 'recruit'"> <t t-if="record.state.raw_value == 'recruit'">
<div class="oe_applications"> <div class="oe_applications">
@ -483,7 +483,7 @@
<field name="context">{'search_default_in_recruitment': 1}</field> <field name="context">{'search_default_in_recruitment': 1}</field>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
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.
</p> </p>
<p> <p>
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 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