[IMP] base_import: provide an encoding picker
bzr revid: xmo@openerp.com-20121004115024-m77q5c95i12q3qkm
This commit is contained in:
parent
8f3db5bcf1
commit
1b17b59f50
|
@ -128,6 +128,7 @@ openerp.base_import = function (instance) {
|
|||
},
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.setup_encoding_picker();
|
||||
|
||||
return $.when(
|
||||
this._super(),
|
||||
|
@ -139,6 +140,25 @@ openerp.base_import = function (instance) {
|
|||
})
|
||||
)
|
||||
},
|
||||
setup_encoding_picker: function () {
|
||||
this.$('input.oe_import_encoding').select2({
|
||||
width: '160px',
|
||||
query: function (q) {
|
||||
var make = function (term) { return {id: term, text: term}; };
|
||||
var suggestions = _.map(
|
||||
('utf-8 utf-16 windows-1252 latin1 latin2 big5 ' +
|
||||
'gb18030 shift_jis windows-1251 koir8_r').split(/\s+/),
|
||||
make);
|
||||
if (q.term) {
|
||||
suggestions.unshift(make(q.term));
|
||||
}
|
||||
q.callback({results: suggestions});
|
||||
},
|
||||
initSelection: function (e, c) {
|
||||
return c({id: 'utf-8', text: 'utf-8'});
|
||||
}
|
||||
}).select2('val', 'utf-8');
|
||||
},
|
||||
|
||||
import_options: function () {
|
||||
var self = this;
|
||||
|
@ -182,8 +202,7 @@ openerp.base_import = function (instance) {
|
|||
this.$('.oe_import_options').show();
|
||||
this.$el.addClass('oe_import_preview_error oe_import_error');
|
||||
this.$('.oe_import_error_report').html(
|
||||
QWeb.render('ImportView.preview.error', result))
|
||||
.get(0).scrollIntoView();
|
||||
QWeb.render('ImportView.preview.error', result));
|
||||
},
|
||||
onpreview_success: function (event, from, to, result) {
|
||||
this.$('.oe_import_import').removeClass('oe_highlight');
|
||||
|
|
Loading…
Reference in New Issue