-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
[16.0] [MIG] survey_formio #117
base: 16.0
Are you sure you want to change the base?
Conversation
This module adds the necessary function to generate a form.io compatible JSON that represents an odoo survey. It also adds the function that creates or updates a survey_user_input when given the JSON returned by form.io
The dictionnary with the answer for a multiple choice question should only contain true answers.
Currently translated at 100.0% (2 of 2 strings) Translation: survey-13.0/survey-13.0-survey_formio Translate-URL: https://translation.odoo-community.org/projects/survey-13-0/survey-13-0-survey_formio/it/
survey_formio/models/survey.py
Outdated
for answer in multiple_choice_answers_dict.keys(): | ||
answers_dict[question_id + "_" + answer[1:]] = answer[1:] | ||
return answers_dict | ||
return [value for value in multiple_choice_answers_dict.values() if value] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this and it seems there's an issue here.
Saving a multiple choice answer given by formio doesn't work. I think Odoo is waiting for the id of the answer, not its value (see : https://github.com/odoo/odoo/blob/16.0/addons/survey/tests/test_survey_ui_session.py#L210 )
I think this should be
return [value for value in multiple_choice_answers_dict.keys() if value]
or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be better now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works now. Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
f419cdd
to
ae7a799
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM: code review
This PR has the |
From https://github.com/acsone/survey/tree/13.0/survey_formio