Skip to content
Snippets Groups Projects
Commit 7ad309e0 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] survey: matrix results after row deletion

In a survey question of type `matrix`,
nothing prevents to remove a row from the matrix,
even if there are already answers for this line.

If the case happens, the row is deleted, but
not the answers. The answers are therefore orphan.
The answers should probably be deleted when the
row is removed from the survey, but this is a risky
change, and, even, users might want to keep track
of the answers given even if the line doesn't exist
anymore in the survey.

Therefore, we just handle the case when displaying
the survey results,
we ignore matrix answers for which the row no longer
exists.

opw-666393
parent dc48744b
No related branches found
No related tags found
No related merge requests found
......@@ -373,7 +373,7 @@ class survey_survey(osv.Model):
for cell in product(rows.keys(), answers.keys()):
res[cell] = 0
for input_line in question.user_input_line_ids:
if input_line.answer_type == 'suggestion' and (not(current_filters) or input_line.user_input_id.id in current_filters):
if input_line.answer_type == 'suggestion' and (not(current_filters) or input_line.user_input_id.id in current_filters) and input_line.value_suggested_row:
res[(input_line.value_suggested_row.id, input_line.value_suggested.id)] += 1
if input_line.answer_type == 'text' and (not(current_filters) or input_line.user_input_id.id in current_filters):
comments.append(input_line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment