[FIX] survey: No crash when getting stats of answers of a survey

If for any reason the initial linked question of one possible answer was
changed and if one existing survey has already been answered using that
possibility, we currently got an Internal Server Error while we should
simply just ignore these answers when getting the statistics of that
survey.

closes odoo/odoo#75758

X-original-commit: 87096c284872f9aa99f5ae9096cee92663c4933e
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2021-08-31 02:33:44 +00:00
parent 0b07210fe1
commit ad5f8e2eff
+2 -1
View File
@@ -438,7 +438,8 @@ class SurveyQuestion(models.Model):
count_data = dict.fromkeys(suggested_answers, 0)
for line in user_input_lines:
if line.suggested_answer_id or (line.value_char_box and self.comment_count_as_answer):
if line.suggested_answer_id in count_data\
or (line.value_char_box and self.comment_count_as_answer):
count_data[line.suggested_answer_id] += 1
table_data = [{