From 61bce6958cece367c8d83cfe00e7473230a47319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 25 Jan 2019 10:40:08 +0000 Subject: [PATCH] [IMP] survey: slightly improve result template Purpose is to remove an unnecessary template by directly including the "no result" inside the main result template. It eases understanding and updating of templates. This commit is linked to task ID 1932508 and PR #30508. --- addons/survey/controllers/main.py | 4 ++-- addons/survey/views/survey_templates.xml | 23 +++++------------------ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index 80ee9788648..7fa4c42ee26 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -348,8 +348,7 @@ class Survey(http.Controller): filter_display_data = [] filter_finish = False - if not survey.user_input_ids or not [input_id.id for input_id in survey.user_input_ids if input_id.state != 'new']: - result_template = 'survey.no_result' + answers = survey.user_input_ids.filtered(lambda answer: answer.state != 'new' and not answer.test_entry) if 'finished' in post: post.pop('finished') filter_finish = True @@ -359,6 +358,7 @@ class Survey(http.Controller): filter_display_data = survey.get_filter_display_data(filter_data) return request.render(result_template, {'survey': survey, + 'answers': answers, 'survey_dict': self._prepare_result_dict(survey, current_filters), 'page_range': self.page_range, 'current_filters': current_filters, diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index ea3e93a74cd..884151f3ba0 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -415,8 +415,11 @@

+

+ Sorry, no one answered this survey yet. +

-
+
Filters Clear All Filters
@@ -430,7 +433,7 @@
-
+

@@ -720,22 +723,6 @@
-