Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mandatory Conditional Questions Block Navigation After User Reverts Principal Answer #98

Open
jhouxatjvx opened this issue Oct 18, 2023 · 0 comments
Labels

Comments

@jhouxatjvx
Copy link

jhouxatjvx commented Oct 18, 2023

Module

Surveys (Odoo v16.0)

Describe the bug

When a user selects an answer that reveals more-than-one conditional questions where at least one is mandatory, followed by changing principal answer to hide conditional questions, the user is blocked from navigating to the next section.

Only one of the conditional questions must be marked as mandatory to prevent section navigation.

##Severity
Medium to Major
While this bug doesn't completely break survey module, it does break the ability to use multiple conditional questions -- where at least one is mandatory -- in response to a single principal question. This can be a serious problem for strategic information gathering.

To Reproduce

Odoo v16.0:

  1. Create a new survey.
  2. Configure presentation option to "One page per section".
  3. On the questions tab, add two sections and title them Section 1 and Section 2 respectively.
  4. Under the second section add a simple textfield question. This is necessary so that navigating from the first section doesn't go immediately to the end of the survey.
  5. Under the first section, add three multiple choice questions. Name the first question "Principal" and the second and third questions "Conditional 1" and "Conditional 2".
  6. The survey question table should look like this:
    image
  7. On Principal, add two answer choices with these values: "Show additional questions" and "Skip"
  8. On Conditional 1 and Conditional 2, add a couple multiple choice answers for each of them. The answers can be anything you want.
  9. Save the form. (Saving here is necessary so that the conditional options can be configured in the next step).
  10. Configure both conditional questions to be Conditional to the Principal. Set the Triggering Answer to be "Show additional questions"
  11. Make Conditional 1 mandatory. The other two questions should not be mandatory.
  12. Save the form.

Test the Survey

  1. Click Start Survey button.
  2. You should see the Principal Question.
  3. Select "Show additional questions"
  4. You should see the conditional questions.
  5. Change the principal answer to "Skip"
  6. Click Continue button
  7. Nothing should happen! Navigation is blocked!
  8. Change the principal answer to "Show additional questions"
  9. You should see that the first question has the red notice indicating an answer is required.

Follow up changes and Second Test

  1. Close the Test and go back to the Survey admin UI.
  2. Open the options for Conditional 2. Uncheck "Conditional".
  3. Save survey and test it again.
  4. Repeat the same test procedure from above but you should see that navigation works fine.

##Analysis
If there is more-than-one conditional question, the validation logic requires mandatory conditional questions to be answered.

##Additional Concerns
I haven't looked at the javascript code, because I'm completely new to Odoo framework and my time is quite constrained right now. However, I want to voice that the nature of this bug would lead a seasoned developer to question the efficacy of the underlying code. Its a very weird bug that, at least to my mind, suggests the entire validation logic might be a bit shakey -- I find it hard to imagine writing such a weird bug into my own javascript. This is a wildly speculative observation, but I think its worth mentioning. It would be bad if there are other strange bugs lurking with technical debt.

@jhouxatjvx jhouxatjvx added the bug label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant