From aaa7cfa535f06aead908fa9cb9e54b5099cc713c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Thu, 13 Feb 2020 10:46:07 +0000 Subject: [PATCH] [FIX] survey: only show attendees ranking when relevant The computed field 'session_show_ranking' was only computed based on the fact that the survey had a scoring mechanism. It's not very accurate since we also need a question that saves as the attendee nickname to be able to display a relevant ranking chart. This commit fixes the compute method by adding the necessary condition. Task ID 2188482 closes odoo/odoo#45852 X-original-commit: 86ca11517d3872b2bf3cf89eda513a3bc8c84292 Signed-off-by: awa-odoo --- addons/survey/models/survey_survey.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/survey/models/survey_survey.py b/addons/survey/models/survey_survey.py index cd8f002d47c..6f677693cf4 100644 --- a/addons/survey/models/survey_survey.py +++ b/addons/survey/models/survey_survey.py @@ -193,10 +193,11 @@ class Survey(models.Model): survey.session_question_answer_count = answer_count - @api.depends('scoring_type') + @api.depends('scoring_type', 'question_and_page_ids.save_as_nickname') def _compute_session_show_ranking(self): for survey in self: - survey.session_show_ranking = survey.scoring_type != 'no_scoring' + survey.session_show_ranking = survey.scoring_type != 'no_scoring' and \ + any(question.save_as_nickname for question in survey.question_and_page_ids) @api.onchange('scoring_success_min') def _onchange_scoring_success_min(self):