[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
This commit is contained in:
parent
dc48744bf7
commit
7ad309e015
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue