diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-11-16 19:30:20 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-11-16 19:30:20 +0100 |
| commit | 6faad524cf5e4db02855cb213277c40aee14c42a (patch) | |
| tree | 383c984dc1461a03481baa9fbdce8c156ca97e2e /addons/web/models/models.py | |
| parent | 3657dc77c2ddb4275f07d1271b93e7f25e09913a (diff) | |
| parent | bc744a1da46efda6f1eb5c341f2fa5df30c9c7ad (diff) | |
[MERGE] forward port branch 12.0 up to bc744a1da46
Diffstat (limited to 'addons/web/models/models.py')
| -rw-r--r-- | addons/web/models/models.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/models/models.py b/addons/web/models/models.py index 572f07333d2..2e3bd54788d 100644 --- a/addons/web/models/models.py +++ b/addons/web/models/models.py @@ -40,11 +40,14 @@ class Base(models.AbstractModel): records_values = self.search_read(domain or [], [progress_bar['field'], group_by]) data = {} + field_type = self._fields[group_by].type + if field_type == 'selection': + selection_labels = dict(self.fields_get()[group_by]['selection']) + for record_values in records_values: group_by_value = record_values[group_by] # Again, imitating what _read_group_format_result and _read_group_prepare_data do - field_type = self._fields[group_by].type if group_by_value and field_type in ['date', 'datetime']: locale = self._context.get('lang') or 'en_US' group_by_value = fields.Datetime.to_datetime(group_by_value) @@ -61,7 +64,7 @@ class Base(models.AbstractModel): locale=locale) if field_type == 'selection': - group_by_value = dict(self.fields_get()[group_by]['selection'])[group_by_value] + group_by_value = selection_labels[group_by_value] if type(group_by_value) == tuple: group_by_value = group_by_value[1] # FIXME should use technical value (0) |
