diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 3e6dc6f903f..199a8ad9601 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -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). diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index 3298453ea4e..3e75d9b4dec 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -175,30 +175,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + + + - + + + - + - - + @@ -325,16 +290,15 @@ hr.evaluation.interview - + - - - - - + + + + diff --git a/addons/survey/survey.py b/addons/survey/survey.py index f92f2ea4816..95043c3e3d6 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -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'}) diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 2ffeddbeda4..a645f6645df 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -574,9 +574,15 @@ + + + + + + @@ -607,9 +613,8 @@ - - + diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index e22ec99e532..f5be2968792 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -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, } diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py index 4a7af1ae6ac..7c99dd8e24b 100644 --- a/addons/survey/wizard/survey_email_compose_message.py +++ b/addons/survey/wizard/survey_email_compose_message.py @@ -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 diff --git a/addons/survey/wizard/survey_email_compose_message.xml b/addons/survey/wizard/survey_email_compose_message.xml index f92d1270365..cb98fa051f9 100644 --- a/addons/survey/wizard/survey_email_compose_message.xml +++ b/addons/survey/wizard/survey_email_compose_message.xml @@ -19,6 +19,9 @@ ]]> + survey.mail.compose.message.form survey.mail.compose.message @@ -28,10 +31,10 @@ - + - + You can share your survey web public link and/or send private invitations to your audience. People can response once per invitation, and whenever they want with the public web link. @@ -47,8 +50,8 @@ - - + +