diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-07-25 17:57:40 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-07-25 17:57:40 +0200 |
| commit | 47d72f7a0fe80d2ba070c12ff074e9e959524929 (patch) | |
| tree | 3a26176aef1b2a1c3964e9d8bb4c1dfe8d38d50c /addons/web | |
| parent | 27735a2b850571798585975610ef03b9c72d6353 (diff) | |
[IMP] export: delegated ids computation to the python side, the js gives ids or the domain to use; + fixed statically export formats
bzr revid: tde@openerp.com-20130725155740-g9a76z08ogjejp86
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/controllers/main.py | 6 | ||||
| -rw-r--r-- | addons/web/static/src/js/data_export.js | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 33c3f337ecb..966c9e7641a 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1407,8 +1407,10 @@ class Export(http.Controller): :returns: for each export format, a pair of identifier and printable name :rtype: [(str, str)] """ - # TDE regression spotted since frameworek update: was impossible to export, hack to make it work temporarily - return [{'label': 'csv', 'tag': 'csv'}] + # TDE note: was dynamic, broken when improving the framework, temporarily static to make export working + return [{'tag': 'csv', 'label': 'CSV'}, + {'tag': 'xls', 'label': 'Excel', 'error': None if xlwt else "XLWT required"}] + def fields_get(self, model): Model = request.session.model(model) diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index d0ac4718c17..e58cc551ed1 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -379,15 +379,16 @@ instance.web.DataExport = instance.web.Dialog.extend({ var export_format = this.$el.find("#export_format").val(); - var ids_computation = this.getParent().get_active_domain().then(function (results) { - if (results === undefined) { - return self.getParent().get_selected_ids(); + this.getParent().get_active_domain().then(function (domain) { + if (domain === undefined) { + var ids_to_export = self.getParent().get_selected_ids(); + var domain = self.dataset.domain; } else { - return self.dataset.call('search', [results]); + var ids_to_export = false; + var domain = domain; } - }); - $.when(ids_computation).done(function (ids_to_export) { + var ids_t_ instance.web.blockUI(); self.session.get_file({ url: '/web/export/' + export_format, @@ -395,7 +396,7 @@ instance.web.DataExport = instance.web.Dialog.extend({ model: self.dataset.model, fields: exported_fields, ids: ids_to_export, - domain: self.dataset.domain, + domain: domain, import_compat: !!self.$el.find("#import_compat").val(), })}, complete: instance.web.unblockUI, |
