summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-20 20:12:13 +0200
committerGéry Debongnie <ged@odoo.com>2017-04-21 13:58:57 +0200
commitfb06850e492fdb4f1f4d7a03cae09abed506b89a (patch)
treefe9cdb8a2b190ca5446568d1008db83c8d55384d /addons/web/static/src/js/fields
parenta6c64399d273d7dbb271cd550211580a1e89f850 (diff)
[FIX] web: prevent onchanges with invalid values
Before this commit, when a field was changed, it always triggered a field_change event, with the new value, even if that value is not valid. As a result, it could happen that an onchange was sent to the server with a string as the value of a float field. What we do in this commit is making sure that invalid values do not escape the confine of a field, by returning immediately after detecting that a value is not valid.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/abstract_field.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/abstract_field.js b/addons/web/static/src/js/fields/abstract_field.js
index 0c7b6d71908..d2a317bd3b2 100644
--- a/addons/web/static/src/js/fields/abstract_field.js
+++ b/addons/web/static/src/js/fields/abstract_field.js
@@ -338,6 +338,7 @@ var AbstractField = Widget.extend({
this._isValid = true;
} catch (e) {
this._isValid = false;
+ return;
}
var changes = {};
changes[this.name] = value;