diff --git a/addons/hr_recruitment_survey/models/hr_applicant.py b/addons/hr_recruitment_survey/models/hr_applicant.py
index 7b62eb205b4..acbdd795753 100644
--- a/addons/hr_recruitment_survey/models/hr_applicant.py
+++ b/addons/hr_recruitment_survey/models/hr_applicant.py
@@ -18,12 +18,18 @@ class Applicant(models.Model):
.filtered(lambda i: i.survey_id == self.survey_id)\
.sorted(lambda i: i.create_date, reverse=True)
if not sorted_interviews:
- return self.survey_id.action_print_survey()
+ action = self.survey_id.action_print_survey()
+ action['target'] = 'new'
+ return action
answered_interviews = sorted_interviews.filtered(lambda i: i.state == 'done')
if answered_interviews:
- return self.survey_id.action_print_survey(answer=answered_interviews[0])
- return self.survey_id.action_print_survey(answer=sorted_interviews[0])
+ action = self.survey_id.action_print_survey(answer=answered_interviews[0])
+ action['target'] = 'new'
+ return action
+ action = self.survey_id.action_print_survey(answer=sorted_interviews[0])
+ action['target'] = 'new'
+ return action
def action_send_survey(self):
self.ensure_one()
@@ -32,7 +38,7 @@ class Applicant(models.Model):
if not self.partner_id:
if not self.partner_name:
raise UserError(_('Please provide an applicant name.'))
- self.partner_id = self.env['res.partner'].create({
+ self.partner_id = self.env['res.partner'].sudo().create({
'is_company': False,
'type': 'private',
'name': self.partner_name,
diff --git a/addons/hr_recruitment_survey/security/hr_recruitment_survey_security.xml b/addons/hr_recruitment_survey/security/hr_recruitment_survey_security.xml
index 4df1366f2e5..66b739eadb7 100644
--- a/addons/hr_recruitment_survey/security/hr_recruitment_survey_security.xml
+++ b/addons/hr_recruitment_survey/security/hr_recruitment_survey_security.xml
@@ -1,8 +1,28 @@
-
-
+
+
+ It will also allow to send surveys and see the resume.
+
+
+ Survey user input: officer: read all non private survey answers
+ [('applicant_id', '=', False)]
+
+
+ Survey user input: recruitment interview: read survey answers for which they are set as interviewer
+
+ [
+ ('applicant_id', '!=', False),
+ '|',
+ ('applicant_id.interviewer_ids', 'in', user.id),
+ ('applicant_id.job_id.interviewer_ids', 'in', user.id),
+ ]
+
+
+
+
+
diff --git a/addons/hr_recruitment_survey/views/hr_applicant_views.xml b/addons/hr_recruitment_survey/views/hr_applicant_views.xml
index 54680b5d034..fab2019ac64 100644
--- a/addons/hr_recruitment_survey/views/hr_applicant_views.xml
+++ b/addons/hr_recruitment_survey/views/hr_applicant_views.xml
@@ -26,7 +26,7 @@
icon="fa-pencil-square-o"
type="object"
help="See interview report"
- attrs="{'invisible':['|',('survey_id','=',False),('response_ids','=',False)]}">
+ attrs="{'invisible':['|',('survey_id','=',False),('response_ids','=',[])]}">
Consult
Interview
diff --git a/addons/hr_recruitment_survey/wizard/survey_invite.py b/addons/hr_recruitment_survey/wizard/survey_invite.py
index 6d01cc484d5..3c1a9bae9b8 100644
--- a/addons/hr_recruitment_survey/wizard/survey_invite.py
+++ b/addons/hr_recruitment_survey/wizard/survey_invite.py
@@ -31,8 +31,8 @@ class SurveyInvite(models.TransientModel):
survey = self.survey_id.with_context(clean_context(self.env.context))
if not self.applicant_id.response_ids.filtered(lambda res: res.survey_id.id == self.survey_id.id):
- self.applicant_id.write({
- 'response_ids': (self.applicant_id.response_ids | survey._create_answer(partner=self.applicant_id.partner_id,
+ self.applicant_id.sudo().write({
+ 'response_ids': (self.applicant_id.response_ids | survey.sudo()._create_answer(partner=self.applicant_id.partner_id,
**self._get_answers_values())).ids
})