jorv 02df60b307 [FIX] survey : use correct page_ids for progression template
Bug

A previous commit b1ec81ed fixed an issue relating to wrong progression
percentages when a survey was set as "one page per question" and
"random selection".
In doing so, it inadvertently added an issue in the following  simplified case:

1. Create a new survey, and add 2 questions
2. Set layout (`question_layout`) to "one page per question" (`page_per_question`)
3. Set selection (`question_selection`) to "all questions" (`all`)
4. Now share the survey with a participant (send out the email)
5. As the participant, start the survey and answer question one
6. In the backend, go and modify the survey template by adding a new
question after question 2. Save modification.
7. Now, in the ongoing survey, answer question 2 and try to move on to
the next question.

This will create an error traceback. Example
'''
'page_number': page_ids.index(survey_data['question'].id)
ValueError: 108 is not in list
'''

The error arises because the added question will have an id that is not
in the `survey.user_input.predefined_question_ids` field. This list gets
initialized when the `survey.user_input` gets created and reflects all
the question ids of the original survey template (or the random ids in
case of a random selection).
So in other terms the set of questions given to a participant, starting
in `survey_survey._get_pages_or_questions` is not aligned with those used
for the references in the progression template

Proposed fix:
We add an extra check for `survey_sudo.questions_selection == 'random'`
to decide if we use `survey.user_input.predefined_question_ids` or
`survey.survey.question_ids` information to calculate the progession.

opw-3516304

closes odoo/odoo#141171

X-original-commit: 643fceff43770483f11e95bd57fae60e611f83d4
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Joel Rodrigues Vitória (jorv) <jorv@odoo.com>
2023-11-06 15:36:55 +00:00
2023-10-27 08:36:16 +00:00
2023-11-02 21:02:44 +00:00
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%