[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.
This commit is contained in:
Aaron Bohy
2017-05-18 13:55:46 +02:00
parent abacdd9776
commit f77e86b67b
+1 -1
View File
@@ -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: