[IMP] survey,hr: buttons
bzr revid: chm@openerp.com-20130228152312-taz6qkh6hgr1s5pm
This commit is contained in:
@@ -207,7 +207,6 @@ class hr_evaluation(osv.osv):
|
||||
'evaluation_id': evaluation.id,
|
||||
'survey_id': phase.survey_id.id,
|
||||
'date_deadline': datetime.now() + relativedelta(months=1),
|
||||
'partner_id': child.user_id and child.user_id.partner_id.id or None,
|
||||
'email': child.work_email or None,
|
||||
'user_to_review_id': evaluation.employee_id.id,
|
||||
'response_type': 'link',
|
||||
@@ -248,8 +247,8 @@ class hr_evaluation(osv.osv):
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
interview_obj = self.pool.get('hr.evaluation.interview')
|
||||
evaluation = self.browse(cr, uid, ids[0], context)
|
||||
interview_obj.survey_req_cancel(cr, uid, [r.id for r in evaluation.survey_response_ids])
|
||||
evaluation = self.browse(cr, uid, ids[0], context=context)
|
||||
interview_obj.action_cancel(cr, uid, [r.id for r in evaluation.survey_response_ids], context=context)
|
||||
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
@@ -301,12 +300,34 @@ class hr_evaluation_interview(osv.osv):
|
||||
'response_id': fields.many2one('survey.response', 'Request_id', ondelete='cascade', required=True),
|
||||
'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
|
||||
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Appraisal Form'),
|
||||
'user_id': fields.many2one('res.users', 'Interviewer', readonly=1),
|
||||
'user_id': fields.many2one('res.users', 'Interviewer'),
|
||||
}
|
||||
_defaults = {
|
||||
'is_evaluation': True,
|
||||
}
|
||||
|
||||
def action_survey_resent(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
return self.pool.get('survey.response').action_survey_resent(cr, uid, [record.response_id.id], context=context)
|
||||
|
||||
def action_print_response(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
return self.pool.get('survey.response').action_print_response(cr, uid, [record.response_id.id], context=context)
|
||||
|
||||
def action_preview(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
return self.pool.get('survey.response').action_preview(cr, uid, [record.response_id.id], context=context)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
return self.pool.get('survey.response').action_cancel(cr, uid, [record.response_id.id], context=context)
|
||||
|
||||
def action_fill(self, cr, uid, ids, context=None):
|
||||
record = self.browse(cr, uid, ids[0], context=context)
|
||||
action = self.pool.get('survey.response').action_preview(cr, uid, [record.response_id.id], context=None)
|
||||
action['context']['readonly'] = False
|
||||
return action
|
||||
|
||||
def _needaction_domain_get(self, cr, uid, context=None):
|
||||
return ['|',
|
||||
'&', ('state', '=', 'done'), ('user_id', '=', uid),
|
||||
@@ -345,10 +366,6 @@ class hr_evaluation_interview(osv.osv):
|
||||
self.write(cr, uid, ids, {'state': 'done'}, context=context)
|
||||
return True
|
||||
|
||||
def survey_req_cancel(self, cr, uid, ids, context=None):
|
||||
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).
|
||||
|
||||
@@ -175,30 +175,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group string="Appraisal Forms" attrs="{'invisible':[('state','=','draft')]}">
|
||||
<field nolabel="1" name="survey_response_ids">
|
||||
<form string="Interview Appraisal" version="7.0">
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [id], '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' : [id], 'response_no':0,}"/>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="survey_id"/>
|
||||
<field name="user_to_review_id"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_deadline"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="4" string="Status" invisible="1">
|
||||
<field name="state"/>
|
||||
<div>
|
||||
<button string="Done" name="survey_req_done" states="new,skip" type="object" icon="gtk-jump-to" />
|
||||
</div>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
<field nolabel="1" name="survey_response_ids"/>
|
||||
</group>
|
||||
<group string="Internal Notes" attrs="{'invisible':[('state','=','draft')]}">
|
||||
<field nolabel="1" name="note_action"
|
||||
@@ -281,38 +258,26 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Interview Appraisal" version="7.0">
|
||||
<header>
|
||||
<button string="Cancel" name="survey_req_cancel" type="object"
|
||||
states="draft,waiting_answer" class="oe_left"/>
|
||||
<button string="Print Survey" name="action_print_survey" type="object"
|
||||
states="draft" context="{'survey_id': survey_id, 'response_id': [id], 'response_no':0}"
|
||||
attrs="{'readonly':[('survey_id','=',False)]}" class="oe_highlight"/>
|
||||
<button string="Send Request" name="survey_req_waiting_answer" type="object"
|
||||
states="draft" class="oe_highlight"/>
|
||||
<button string="Answer Survey" name="%(survey.action_view_survey_question_message)d" type="action"
|
||||
states="waiting_answer" class="oe_highlight"
|
||||
context="{'survey_id': survey_id, 'response_id': [id], '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"
|
||||
states="waiting_answer"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="waiting_answer,done"/>
|
||||
<button name="action_cancel" states="new,skip" string="Cancel" type="object" icon="gtk-stop"/>
|
||||
<button name="action_fill" states="new,skip" string="Answer Survey" type="object"/>
|
||||
<button string="Done" name="survey_req_done" type="object" states="new,skip" icon="gtk-apply"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<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"
|
||||
states="waiting_answer"
|
||||
context="{'default_body_text': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks',
|
||||
'default_subject': 'Reminder to fill up Survey' }"/>
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/><br/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="survey_id"/>
|
||||
<field name="user_to_review_id"/>
|
||||
<field name="user_to_review_id" readonly="1"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_deadline"/>
|
||||
<field name="state"/>
|
||||
<field name="evaluation_id" string="Appraisal Plan"/>
|
||||
<field name="evaluation_id" string="Appraisal Plan" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
@@ -325,16 +290,15 @@
|
||||
<field name="model">hr.evaluation.interview</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Interview Appraisal">
|
||||
<field name="date_deadline" string="Deadline Date"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="date_deadline"/>
|
||||
<field name="user_id"/>
|
||||
<field name="user_to_review_id"/>
|
||||
<field name="response_id" readonly="1" invisible="True"/>
|
||||
<button name="%(survey.action_view_survey_question_message)d" string="Answer Survey" type="action" states="waiting_answer" icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [id], 'response_no':0, 'active' : response, 'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>
|
||||
<button name="action_print_survey" string="Print Survey" type="object" icon="gtk-print" context="{'survey_id': survey_id, 'response_id': [id], 'response_no':0}" 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"/>
|
||||
<field name="state"/>
|
||||
<button string="Done" name="survey_req_done" states="new,skip" type="object" icon="gtk-jump-to" />
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/>
|
||||
<button name="action_fill" states="new,skip" string="Answer Survey" type="object" icon="gtk-execute"/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -675,11 +675,10 @@ class survey_response(osv.osv):
|
||||
context = context or {}
|
||||
context.update({
|
||||
'survey_resent_token': True,
|
||||
'default_partner_ids': [record.partner_id.id],
|
||||
'multi_email': [record.email],
|
||||
'default_partner_ids': record.partner_id and [record.partner_id.id] or [],
|
||||
'default_multi_email': record.email or "",
|
||||
'default_public': 'email',
|
||||
})
|
||||
|
||||
return self.pool.get('survey').action_survey_sent(cr, uid, [record.survey_id.id], context=context)
|
||||
|
||||
def action_print_response(self, cr, uid, ids, context=None):
|
||||
@@ -725,7 +724,7 @@ class survey_response(osv.osv):
|
||||
'context': context
|
||||
}
|
||||
|
||||
def action_cancel(self, cr, uid, ids, arg):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
self.pool.get('survey').check_access_rights(cr, uid, 'write')
|
||||
return self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
|
||||
|
||||
@@ -574,9 +574,15 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey Response" version="7.0">
|
||||
<header>
|
||||
<button name="action_cancel" states="new,skip" string="Cancel" type="object" icon="gtk-stop"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" name="button_box">
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/><br/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</div>
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="survey_id"/>
|
||||
@@ -607,9 +613,8 @@
|
||||
<field name="email"/>
|
||||
<field name="response_type"/>
|
||||
<field name="state"/>
|
||||
<button name="action_cancel" states="new,skip" string="Cancel" type="object" icon="gtk-stop"/>
|
||||
<button name="action_survey_resent" states="new,skip" string="Resent the invitation" type="object" icon="gtk-redo"/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-copy"/>
|
||||
<button name="action_preview" states="done,skip" string="Preview" type="object" icon="gtk-zoom-fit"/>
|
||||
<button name="action_print_response" states="done,skip" string="Print response" type="object" icon="gtk-print"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -430,7 +430,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||
else:
|
||||
etree.SubElement(xml_footer, 'label', {'string': ""})
|
||||
etree.SubElement(xml_footer, 'button', {'name': "action_next", 'string': _("Next"), 'type': "object", 'context': tools.ustr(context), 'class': not response_info['readonly'] and "oe_highlight" or ""})
|
||||
if context.get('ir_actions_act_window_target') == 'edit':
|
||||
if context.get('ir_actions_act_window_target') != 'inline':
|
||||
etree.SubElement(xml_footer, 'label', {'string': _("or")})
|
||||
etree.SubElement(xml_footer, 'button', {'special': "cancel", 'string': _("Exit"), 'class': "oe_link"})
|
||||
etree.SubElement(xml_footer, 'label', {'string': tools.ustr(page_number + 1) + "/" + tools.ustr(total_pages), 'class': "oe_survey_title_page oe_right"})
|
||||
@@ -1132,7 +1132,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||
"view_mode": 'form',
|
||||
'res_model': 'survey.question.wiz',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': context.get('ir_actions_act_window_target', 'inline'),
|
||||
'target': context.get('ir_actions_act_window_target', 'new'),
|
||||
'context': context
|
||||
}
|
||||
|
||||
@@ -1180,7 +1180,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||
"view_mode": 'form',
|
||||
'res_model': 'survey.question.wiz',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': context.get('ir_actions_act_window_target', 'inline'),
|
||||
'target': context.get('ir_actions_act_window_target', 'new'),
|
||||
'context': context,
|
||||
'view_id': view_id,
|
||||
}
|
||||
|
||||
@@ -149,6 +149,10 @@ class survey_mail_compose_message(osv.TransientModel):
|
||||
raise osv.except_osv(_('Warning!'), _("The content of the text don't contain '__URL__'. \
|
||||
__URL__ is automaticaly converted into the special url of the survey."))
|
||||
|
||||
if not wizard.multi_email and not wizard.partner_ids and (context.get('default_partner_ids') or context.get('default_multi_email')):
|
||||
wizard.multi_email = context.get('default_multi_email')
|
||||
wizard.partner_ids = context.get('default_partner_ids')
|
||||
|
||||
emails = list(set(emails_split.split(wizard.multi_email or "")) - set([partner.email for partner in wizard.partner_ids]))
|
||||
|
||||
# quick check of email list
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
]]></field>
|
||||
</record>
|
||||
|
||||
<!--Survey send
|
||||
Context['survey_resent_token'], if True, hidde share option, emails list and partner_ids
|
||||
-->
|
||||
<record model="ir.ui.view" id="survey_email_compose_message">
|
||||
<field name="name">survey.mail.compose.message.form</field>
|
||||
<field name="model">survey.mail.compose.message</field>
|
||||
@@ -28,10 +31,10 @@
|
||||
<field name="model" invisible="1"/>
|
||||
<field name="res_id" invisible="1"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<group col="2">
|
||||
<group col="2" invisible="context.get('survey_resent_token')">
|
||||
<field name="public"/>
|
||||
</group>
|
||||
<group col="1" attrs="{'invisible':[('public','in',['email', 'email_public_link'])]}" class="oe_survey_email_public">
|
||||
<group col="1" invisible="context.get('survey_resent_token')" attrs="{'invisible':[('public','in',['email', 'email_public_link'])]}" class="oe_survey_email_public">
|
||||
<div>
|
||||
You can share your survey web public link and/or send private invitations to your audience.<br/>
|
||||
People can response once per invitation, and whenever they want with the public web link.
|
||||
@@ -47,8 +50,8 @@
|
||||
</group>
|
||||
<group col="1" attrs="{'invisible':['|',('public','=',False),('public','in',['public_link'])]}">
|
||||
<group col="2">
|
||||
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add list of existing contacts..." context="{'force_email':True, 'show_email':True}"/>
|
||||
<field name="multi_email" placeholder="Add list of email of recipients (will not converted in partner), separated by commas, semicolons or newline..." on_change="onchange_multi_email(multi_email, context)" no_resize="1"/>
|
||||
<field invisible="context.get('survey_resent_token')" name="partner_ids" widget="many2many_tags_email" placeholder="Add list of existing contacts..." context="{'force_email':True, 'show_email':True}"/>
|
||||
<field invisible="context.get('survey_resent_token')" name="multi_email" placeholder="Add list of email of recipients (will not converted in partner), separated by commas, semicolons or newline..." on_change="onchange_multi_email(multi_email, context)" no_resize="1"/>
|
||||
<field name="subject" placeholder="Subject..."/>
|
||||
</group>
|
||||
<field name="body" help="__URL__ will be automatically transformed into web address (public or private, depending on your choice). You can click on 'Show Source' button to see __URL__ in the link tag on the email template."/>
|
||||
|
||||
Reference in New Issue
Block a user