From f2fccdfaf02702f2e1cd3b9825425616f9774139 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 22 Apr 2015 17:06:16 +0200 Subject: [PATCH] [FIX] web: allow to export unordinary table Previously, there was an exception when exporting unordinary table (e.g: reports) coming from the export of the xml_id. With this change, if the table is not ordinary, the xml_id is not present in the exported file. closes #6428 issue #6336 opw-633066 --- addons/web/controllers/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 695b3f4034a..dd6a3e83bd7 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1425,6 +1425,9 @@ class ExportFormat(object): context = dict(request.context or {}, **params.get('context', {})) ids = ids or Model.search(domain, 0, False, False, context) + if not request.env[model]._is_an_ordinary_table(): + fields = [field for field in fields if field['name'] != 'id'] + field_names = map(operator.itemgetter('name'), fields) import_data = Model.export_data(ids, field_names, self.raw_data, context=context).get('datas',[])