From c3e425efd2a003834576a76e4cc7c30233fa76c4 Mon Sep 17 00:00:00 2001 From: Kinjal Mehta Date: Thu, 12 May 2016 18:58:40 +0530 Subject: [PATCH] [IMP] Survey: Stat button + ability to clean test answers ====== purpose ====== - Allow user directly see the Answers of the Survey from Survey Form view. - Allow user to Delete all the test answers from Survey Card. ========== specification ========== - Add a stat button called "Answers" in the form view of survey with the counter = number of people who have filled it up. It shows the backend answers because the action button "view results" will show the front end report. When clicking on it, a group-by Partner will be set. - On the survey form, add "Clean test answers" in the action menu --- addons/survey/survey.py | 10 ++++++-- addons/survey/views/survey_views.xml | 35 +++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 015957ca175..c9fe62659a0 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -486,8 +486,14 @@ class survey_survey(osv.Model): 'url': self.read(cr, uid, ids, ['public_url'], context=context)[0]['public_url'] + "/phantom" } - - + def action_survey_user_input(self, cr, uid, ids, context=None): + action_rec = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'survey.action_survey_user_input', context=context) + action = action_rec.read()[0] + ctx = dict(context) + ctx.update({'search_default_survey_id': ids[0], + 'search_default_completed': 1}) + action['context'] = ctx + return action class survey_page(osv.Model): '''A page for a survey. diff --git a/addons/survey/views/survey_views.xml b/addons/survey/views/survey_views.xml index 7aaa3706766..a85100f4f5b 100644 --- a/addons/survey/views/survey_views.xml +++ b/addons/survey/views/survey_views.xml @@ -11,7 +11,7 @@ - + @@ -125,10 +125,16 @@ -
- +