[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>
This commit is contained in:
committed by
Nicolas Martinelli
parent
7636a0f267
commit
3ea6180f18
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user