[FIX] base_import: list possible separators in a combo box for easier handling of tab-separated files
inserting a tab character in a text field is often difficult, as it's also used to switch between activable nodes bzr revid: xmo@openerp.com-20130204135701-yta16mkvw2pmh6hs
This commit is contained in:
parent
02c7eba1d0
commit
e491b32e96
|
@ -134,6 +134,7 @@ openerp.base_import = function (instance) {
|
|||
start: function () {
|
||||
var self = this;
|
||||
this.setup_encoding_picker();
|
||||
this.setup_separator_picker();
|
||||
|
||||
return $.when(
|
||||
this._super(),
|
||||
|
@ -164,6 +165,26 @@ openerp.base_import = function (instance) {
|
|||
}
|
||||
}).select2('val', 'utf-8');
|
||||
},
|
||||
setup_separator_picker: function () {
|
||||
this.$('input.oe_import_separator').select2({
|
||||
width: '160px',
|
||||
query: function (q) {
|
||||
var suggestions = [
|
||||
{id: ',', text: _t("Comma")},
|
||||
{id: ';', text: _t("Semicolon")},
|
||||
{id: '\t', text: _t("Tab")},
|
||||
{id: ' ', text: _t("Space")}
|
||||
];
|
||||
if (q.term) {
|
||||
suggestions.unshift({id: q.term, text: q.term});
|
||||
}
|
||||
q.callback({results: suggestions});
|
||||
},
|
||||
initSelection: function (e, c) {
|
||||
return c({id: ',', text: _t("Comma")});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
import_options: function () {
|
||||
var self = this;
|
||||
|
|
Loading…
Reference in New Issue