[FIX] web: fix export m2m fields on using group_by
Export tool is based on ORM method `_export_rows`. The method has special processing of m2m fields when user checked *Import compatible* option [1]. Before this commit the negative value of `import_compatible` parameter wasn't passed when data are exported in grouping mode. This led to empty values in m2m fields. STEPS: * Order some products via website and pay via wire transfer * Open Orders menu in backend * group order by any field * expand group with the order * add field *Transactions/Acquirer/Display Name* [1]: https://github.com/odoo/odoo/blob/b28c44a38698018ebbbc420f6567c17b2b97c279/odoo/models.py#L894-L914 opw-2864737 closes odoo/odoo#110151 X-original-commit: 6647ac83467207f4f4ef23aac96ebaf5333b967b Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
@@ -469,7 +469,7 @@ class ExportFormat(object):
|
||||
model, fields, ids, domain, import_compat = \
|
||||
operator.itemgetter('model', 'fields', 'ids', 'domain', 'import_compat')(params)
|
||||
|
||||
Model = request.env[model].with_context(**params.get('context', {}))
|
||||
Model = request.env[model].with_context(import_compat=import_compat, **params.get('context', {}))
|
||||
if not Model._is_an_ordinary_table():
|
||||
fields = [field for field in fields if field['name'] != 'id']
|
||||
|
||||
@@ -493,7 +493,6 @@ class ExportFormat(object):
|
||||
|
||||
response_data = self.from_group_data(fields, tree)
|
||||
else:
|
||||
Model = Model.with_context(import_compat=import_compat)
|
||||
records = Model.browse(ids) if ids else Model.search(domain, offset=0, limit=False, order=False)
|
||||
|
||||
export_data = records.export_data(field_names).get('datas', [])
|
||||
|
||||
Reference in New Issue
Block a user