From 92141334f870a4d253da53e7ef3abcd7894d11bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Wed, 27 Feb 2019 13:47:33 +0000 Subject: [PATCH] [FIX] survey: fix survey statistics computation Purpose ======= This commit fixes the shared dict in the survey statistics computation that causes surveys to incorrectly share the same stats when computed in batch. --- addons/survey/models/survey_survey.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/survey/models/survey_survey.py b/addons/survey/models/survey_survey.py index a6b106e1531..c49aa846de4 100644 --- a/addons/survey/models/survey_survey.py +++ b/addons/survey/models/survey_survey.py @@ -104,7 +104,7 @@ class Survey(models.Model): @api.depends('user_input_ids.state', 'user_input_ids.test_entry') def _compute_survey_statistic(self): - stat = dict.fromkeys(self.ids, {'invite_count': 0, 'answer_count': 0, 'answer_done_count': 0}) + stat = dict((cid, dict(invite_count=0, answer_count=0, answer_done_count=0)) for cid in self.ids) UserInput = self.env['survey.user_input'] base_domain = ['&', ('survey_id', 'in', self.ids), ('test_entry', '!=', True)]