Skip to content
Snippets Groups Projects
Commit 8049d1e8 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] base_import: file type on Windows

When a user imports a CSV file on Windows, the "CSV Format Options…"
field does not appear. This is an issue since it might be necessary to
tune these options depending on the file, e.g. change the encoding.

For some unknown reason, on Windows, the file type is empty whatever the
browser used. Therefore, we fall back on the extension of the file.

opw-680347
parent a46f3616
No related branches found
No related tags found
No related merge requests found
......@@ -237,7 +237,12 @@ var DataImport = Widget.extend(ControlPanelMixin, {
if (!this.$('input.oe_import_file').val()) { return; }
this.$el.removeClass('oe_import_preview oe_import_error');
this.$el.find('.oe_import_toggle').toggle((this.$('input.oe_import_file')[0].files[0].type == "text/csv"));
var import_toggle = false;
var file = this.$('input.oe_import_file')[0].files[0];
if (file.type === "text/csv" || (file.type === "" && _.last(file.name.split('.')) === "csv")) {
import_toggle = true;
}
this.$el.find('.oe_import_toggle').toggle(import_toggle);
jsonp(this.$el, {
url: '/base_import/set_file'
}, this.proxy('settings_changed'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment