diff options
| author | jerome hanke (jhk) <jhk@odoo.com> | 2020-02-26 12:31:41 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-03-23 17:40:01 +0000 |
| commit | 3ea6180f182d6ea06b963fe437be05b380f1ee46 (patch) | |
| tree | 98677c857a40d9a6f48a9a9edfdad690d85021b5 /addons/web/controllers/main.py | |
| parent | 7636a0f267b5ca5b2d710567529fad4b15b398df (diff) | |
[FIX] web: export of id from grouped elements does not fail
Steps to reproduce:
- install sales
- go to sales > go to any list view (SO for example) and group by
anything (customer for example)
- click on action > export > add ID to the exported columns
- click export
Previous behavior:
you get a traceback: "Invalid field specification '.id'."
Current behavior:
ids are exported as intended
opw-2194233
closes odoo/odoo#48222
X-original-commit: c8217080d960ec3f8436111ce60a17754fe64f2d
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/web/controllers/main.py')
| -rw-r--r-- | addons/web/controllers/main.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 1fece767a0d..3b0e2e27f28 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -660,6 +660,8 @@ class GroupsTreeNode: """ Return field names of exported field having a group operator """ aggregated_field_names = [] for field_name in self._export_field_names: + if field_name == '.id': + field_name = 'id' if '/' in field_name: # Currently no support of aggregated value for nested record fields # e.g. line_ids/analytic_line_ids/amount @@ -1857,7 +1859,7 @@ class ExportFormat(object): if not import_compat and groupby: groupby_type = [Model._fields[x.split(':')[0]].type for x in groupby] domain = [('id', 'in', ids)] if ids else domain - groups_data = Model.read_group(domain, field_names, groupby, lazy=False) + groups_data = Model.read_group(domain, [x if x != '.id' else 'id' for x in field_names], groupby, lazy=False) # read_group(lazy=False) returns a dict only for final groups (with actual data), # not for intermediary groups. The full group tree must be re-constructed. |
