[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
This commit is contained in:
Nicolas Lempereur 2015-04-22 17:06:16 +02:00
parent f2ef46e9f4
commit f2fccdfaf0
1 changed files with 3 additions and 0 deletions

View File

@ -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',[])