From f77e86b67ba8e8654d6f051239bacb0efdb8d7b1 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 18 May 2017 11:26:24 +0200 Subject: [PATCH] [FIX] mass_mailing: read_group: grouped on selection field The model MassMailing overrides read_group to handle the case when it is grouped by field state, which is of type selection. However, it sets as value for each group the array [key, name] of the selection option, which is incorrect (it should set key as value, like the default read_group does, and as the name is known client side anyway). This case was handled by the old views, but it isn't by the new ones, which are less permissive. We choose to fix the read_group override instead of allowing both cases in JS, as it is always better to have a clear and single API. --- addons/mass_mailing/models/mass_mailing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 4c3bab77de1..8daa5ce392b 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -500,7 +500,7 @@ class MassMailing(models.Model): res = filter(lambda x: x['state'] == state_value, read_group_res) if not res: res = filter(lambda x: x['state'] == state_value, read_group_all_states) - res[0]['state'] = [state_value, state_name] + res[0]['state'] = state_value result.append(res[0]) return result else: