From 85f50060183a930f2079bed80949afa744ab2bb8 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Thu, 4 Aug 2022 09:47:11 +0000 Subject: [PATCH] [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) --- addons/web/controllers/export.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web/controllers/export.py b/addons/web/controllers/export.py index 5fdfbc25353..e944e898593 100644 --- a/addons/web/controllers/export.py +++ b/addons/web/controllers/export.py @@ -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', [])