summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2015-10-29 11:33:16 +0100
committerNicolas Martinelli <nim@odoo.com>2015-10-29 12:44:07 +0100
commit1f43fa9dfe727719168f6d19aa8d1b8ca14d5f72 (patch)
tree5d3919decc9dbe609ef0accadda92fb6b7f3af44
parentd7b0a56f34d569f090239588cd3e8cd9263f6429 (diff)
[FIX] web: do not write twice when updating value
The issue occurs for example in the Sale dashboard, when the user changes the target amount. If the user changes the value, then directly clicks outside of the field, the method on_change_input will be called twice: the first time because of the event 'change input', the second time because of the event 'blur input'. This makes an unnecessary write, which can cause an error due to concurrent access. This prevents the execution of the write related to the event 'change input' in this case. If the user changes the value but clicks on 'Enter', the focus is still on the field so the update is done correctly. Courtesy of Quentin Smetz (qsm@odoo.com) opw-653086
-rw-r--r--addons/web/static/src/js/widgets/progress_bar.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web/static/src/js/widgets/progress_bar.js b/addons/web/static/src/js/widgets/progress_bar.js
index abe1009b1fa..6ccd1e74f28 100644
--- a/addons/web/static/src/js/widgets/progress_bar.js
+++ b/addons/web/static/src/js/widgets/progress_bar.js
@@ -72,6 +72,9 @@ var ProgressBar = Widget.extend({
on_change_input: function(e) {
var $input = $(e.target);
+ if(e.type === 'change' && !$input.is(':focus')) {
+ return;
+ }
if(isNaN($input.val())) {
this.do_warn(_t("Wrong value entered!"), _t("Only Integer Value should be valid."));
} else {