From 36a490f38cb137a6980853eb713b4aa01fa0fe6a Mon Sep 17 00:00:00 2001 From: "Thomas Josse (thjo)" Date: Wed, 26 Oct 2022 09:13:01 +0000 Subject: [PATCH] [FIX] survey: corrects progress number for random questions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Purpose ======= Make sure we display a correct progress number. Specs ===== When configuring a survey as one page per question and the random selection of the questions, the numbers near the progress bar where not correct. With this commit they now are. task-2988062 closes odoo/odoo#109802 X-original-commit: 9487495e5e9a3f6ce899249f7eab6c7074c64464 Signed-off-by: Warnon Aurélien (awa) --- addons/survey/controllers/main.py | 4 +++- addons/survey/views/survey_templates.xml | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index c3a92449680..37568529f89 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -360,7 +360,9 @@ class Survey(http.Controller): 'page_number': page_ids.index(survey_data['page'].id) + (1 if survey_sudo.progression_mode == 'number' else 0) }) elif survey_sudo.questions_layout == 'page_per_question': - page_ids = survey_sudo.question_ids.ids + page_ids = (answer_sudo.predefined_question_ids.ids + if not answer_sudo.is_session_answer + else survey_sudo.question_ids.ids) survey_progress = request.env['ir.qweb']._render('survey.survey_progression', { 'survey': survey_sudo, 'page_ids': page_ids, diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index c5221d2b33c..cd941377caf 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -38,7 +38,12 @@ - + + + + + + @@ -61,7 +66,6 @@
-