summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-03-07 11:57:14 +0100
committerNicolas Martinelli <nim@odoo.com>2017-03-07 11:57:14 +0100
commit4ce309dfabc173183c8102080192366d154fa239 (patch)
tree412861de198de90c4bd830a2ce869930c475a541 /addons/web/static/src
parentfb35132bc655748e8f16fec9540732aecf5bab54 (diff)
[FIX] web: deactivate buttons
To reproduce: - Get a slow connection, e.g. activate throttling in debug mode of the browser. - Create an invoice with at least one tax. - Change a price unit. - Click on 'Save' then repeatedly on 'Validate' The tax lines are duplicated. The issue comes from two identical `write` calls whose purpose is to delete the existing tax line and create a new tax line. The two calls are issued by the click on 'Save' and the click on 'Validate', which triggers a 'Save' since it doesn't consider the form as being saved yet. There were several issues: - The buttons from the statusbar were not disabled - The buttons were enabled too soon. They should be enabled again when the form is reloaded, otherwise the call to 'Validate' doesn't consider the form saved. This is an extension of commit https://github.com/odoo/odoo/commit/bbbf3db581b5cf883 opw-710642
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/form_view.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index 27753aab766..76f9cae7fdd 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -728,11 +728,11 @@ var FormView = View.extend(common.FieldManagerMixin, {
}
},
disable_button: function () {
- this.$('.oe_form_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true);
+ this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button').addClass('o_disabled').prop('disabled', true);
this.is_disabled = true;
},
enable_button: function () {
- this.$('.oe_form_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false);
+ this.$('.oe_form_buttons,.o_statusbar_buttons').add(this.$buttons).find('button.o_disabled').removeClass('o_disabled').prop('disabled', false);
this.is_disabled = false;
},
on_button_save: function(e) {
@@ -747,8 +747,10 @@ var FormView = View.extend(common.FieldManagerMixin, {
self.to_view_mode();
core.bus.trigger('do_reload_needaction');
core.bus.trigger('form_view_saved', self);
+ }).always(function() {
+ self.enable_button();
});
- }).always(function(){
+ }).fail(function(){
self.enable_button();
});
},