[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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user