From d5c8abfd12d8c03b7773b41167a7def35e904b5b Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 15 Nov 2023 16:26:27 +0100 Subject: [PATCH] [FIX] survey: avoid traceback if you don't have finish the survey MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you have a survey of several pages, but don't valid all, you don't have any survey_input_line for some question, so the [0] will crash. Since the method wait only one input_line maximum, instead to force to take the first one withtout take care if no reply, we just use the browser record that will work in both case. If it is empty it will enter in the 4th case, 'skipped' what is expected and was dead code before. closes odoo/odoo#142500 X-original-commit: 02f49b726a40dc97f065ca40225411a208d65302 Signed-off-by: Warnon Aurélien (awa) --- addons/survey/models/survey_user_input.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/survey/models/survey_user_input.py b/addons/survey/models/survey_user_input.py index cc94f7343cf..c5bf934171c 100644 --- a/addons/survey/models/survey_user_input.py +++ b/addons/survey/models/survey_user_input.py @@ -497,8 +497,7 @@ class SurveyUserInput(models.Model): else: return 'skipped' - def _simple_choice_question_answer_result(self, user_input_lines, question_correct_suggested_answers, question_incorrect_scored_answers): - user_input_line = user_input_lines[0] + def _simple_choice_question_answer_result(self, user_input_line, question_correct_suggested_answers, question_incorrect_scored_answers): user_answer = user_input_line.suggested_answer_id if not user_input_line.skipped else self.env['survey.question.answer'] if user_answer in question_correct_suggested_answers: return 'correct'