From a2715888c16f519d531a5aa77f0034791e330758 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 31 Oct 2012 11:31:48 +0100 Subject: [IMP] jQuery deferred API changes refactoring. Changed 'then's in 'done'/'fail' and 'pipe's in 'then' bzr revid: fme@openerp.com-20121031103148-r1slfpl2kcnajjd3 --- addons/base_import/static/src/js/import.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/base_import/static/src') diff --git a/addons/base_import/static/src/js/import.js b/addons/base_import/static/src/js/import.js index 407d38dacd7..416d884956c 100644 --- a/addons/base_import/static/src/js/import.js +++ b/addons/base_import/static/src/js/import.js @@ -139,7 +139,7 @@ openerp.base_import = function (instance) { this._super(), this.Import.call('create', [{ 'res_model': this.res_model - }]).then(function (id) { + }]).done(function (id) { self.id = id; self.$('input[name=import_id]').val(id); }) @@ -198,7 +198,7 @@ openerp.base_import = function (instance) { !this.$('input.oe_import_has_header').prop('checked')); this.Import.call( 'parse_preview', [this.id, this.import_options()]) - .then(function (result) { + .done(function (result) { var signal = result.error ? 'preview_failed' : 'preview_succeeded'; self[signal](result); }); @@ -337,11 +337,11 @@ openerp.base_import = function (instance) { }, onvalidate: function () { return this.call_import({ dryrun: true }) - .then(this.proxy('validated')); + .done(this.proxy('validated')); }, onimport: function () { var self = this; - return this.call_import({ dryrun: false }).then(function (message) { + return this.call_import({ dryrun: false }).done(function (message) { if (!_.any(message, function (message) { return message.type === 'error' })) { self['import_succeeded'](); -- cgit v1.2.3 From aabb0f38fa51ccde3e60ab1517e1b21eecf511ab Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Nov 2012 09:43:53 +0100 Subject: [FIX] base_import: only allow reloading the current file if there *is* a current file loaded bzr revid: xmo@openerp.com-20121106084353-npwkbkg6r0wkwdrg --- addons/base_import/static/src/js/import.js | 10 +++++++--- addons/base_import/static/src/xml/import.xml | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'addons/base_import/static/src') diff --git a/addons/base_import/static/src/js/import.js b/addons/base_import/static/src/js/import.js index 510afaaead8..1f11b3c1e86 100644 --- a/addons/base_import/static/src/js/import.js +++ b/addons/base_import/static/src/js/import.js @@ -179,7 +179,8 @@ openerp.base_import = function (instance) { //- File & settings change section onfile_loaded: function () { - this.$('.oe_import_button').prop('disabled', true); + this.$('.oe_import_button, .oe_import_file_reload') + .prop('disabled', true); if (!this.$('input.oe_import_file').val()) { return; } this.$el.removeClass('oe_import_preview oe_import_error'); @@ -189,7 +190,8 @@ openerp.base_import = function (instance) { }, onpreviewing: function () { var self = this; - this.$('.oe_import_button').prop('disabled', true); + this.$('.oe_import_button, .oe_import_file_reload') + .prop('disabled', true); this.$el.addClass('oe_import_with_file'); // TODO: test that write // succeeded? this.$el.removeClass('oe_import_preview_error oe_import_error'); @@ -205,6 +207,7 @@ openerp.base_import = function (instance) { }, onpreview_error: function (event, from, to, result) { this.$('.oe_import_options').show(); + this.$('.oe_import_file_reload').prop('disabled', false); this.$el.addClass('oe_import_preview_error oe_import_error'); this.$('.oe_import_error_report').html( QWeb.render('ImportView.preview.error', result)); @@ -212,7 +215,8 @@ openerp.base_import = function (instance) { onpreview_success: function (event, from, to, result) { this.$('.oe_import_import').removeClass('oe_highlight'); this.$('.oe_import_validate').addClass('oe_highlight'); - this.$('.oe_import_button').prop('disabled', false); + this.$('.oe_import_button, .oe_import_file_reload') + .prop('disabled', false); this.$el.addClass('oe_import_preview'); this.$('table').html(QWeb.render('ImportView.preview', result)); diff --git a/addons/base_import/static/src/xml/import.xml b/addons/base_import/static/src/xml/import.xml index a121c15f8c8..0da75eb69b9 100644 --- a/addons/base_import/static/src/xml/import.xml +++ b/addons/base_import/static/src/xml/import.xml @@ -30,7 +30,9 @@ -
-- cgit v1.2.3