From e600f525531c8a0f51584a459011e1a9ba5dc406 Mon Sep 17 00:00:00 2001 From: phamvanbao <58139951+baor000@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:50:28 +0700 Subject: [PATCH] [FIX] hr_recruitment_survey: bound applicant with survey answer Issue: When applicant retakes the survey, we only see the first answer of the applicant from -Consult Interview- smartbutton from the applicant form. Desired behavior: We should see the latest answer closes odoo/odoo#159833 Signed-off-by: Sofie Gvaladze (sgv) --- addons/hr_recruitment_survey/__init__.py | 1 + addons/hr_recruitment_survey/controllers/__init__.py | 3 +++ addons/hr_recruitment_survey/controllers/main.py | 12 ++++++++++++ doc/cla/individual/baor000.md | 11 +++++++++++ 4 files changed, 27 insertions(+) create mode 100644 addons/hr_recruitment_survey/controllers/__init__.py create mode 100644 addons/hr_recruitment_survey/controllers/main.py create mode 100644 doc/cla/individual/baor000.md diff --git a/addons/hr_recruitment_survey/__init__.py b/addons/hr_recruitment_survey/__init__.py index 35e7c9600c5..f2cd96d8c83 100644 --- a/addons/hr_recruitment_survey/__init__.py +++ b/addons/hr_recruitment_survey/__init__.py @@ -2,3 +2,4 @@ from . import models from . import wizard +from . import controllers diff --git a/addons/hr_recruitment_survey/controllers/__init__.py b/addons/hr_recruitment_survey/controllers/__init__.py new file mode 100644 index 00000000000..80ee4da1c5e --- /dev/null +++ b/addons/hr_recruitment_survey/controllers/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import main diff --git a/addons/hr_recruitment_survey/controllers/main.py b/addons/hr_recruitment_survey/controllers/main.py new file mode 100644 index 00000000000..85dc7548fb0 --- /dev/null +++ b/addons/hr_recruitment_survey/controllers/main.py @@ -0,0 +1,12 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.addons.survey.controllers import main + + +class ApplicantSurvey(main.Survey): + def _prepare_retry_additional_values(self, answer): + result = super()._prepare_retry_additional_values(answer) + if answer.applicant_id: + result["applicant_id"] = answer.applicant_id.id + + return result diff --git a/doc/cla/individual/baor000.md b/doc/cla/individual/baor000.md new file mode 100644 index 00000000000..9e70dc9c10e --- /dev/null +++ b/doc/cla/individual/baor000.md @@ -0,0 +1,11 @@ +Vietnam, 2024-03-29 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Pham Van Bao 58139951+baor000@users.noreply.github.com https://github.com/baor000 \ No newline at end of file