summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-03-07 16:34:32 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit38300a9bb810580f800afd053973e7a33d2fe663 (patch)
tree1cf77897a716d047c5a9c10e429dc684b2bd1f21 /addons/web/static/src/js/fields/basic_fields.js
parent160dd6a7e601d7b6fa2fd4b27ac08ff851deb364 (diff)
[FIX] web: prevent onchanges from re-rendering the current field
Input fields should not be re-rendered by the onchange mechanism as they might exhibit formatting that you do not want to have when typing. The list view was not propagating the original event to the lower functions like the form view does, so I added it there.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 12699658a7b..6600dbffb0c 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -46,6 +46,21 @@ var InputField = AbstractField.extend({
setTimeout(this.$el.select.bind(this.$el), 0);
},
+ /**
+ * Do not re-render this field if it was the origin of the onchange call.
+ * FIXME: make the onchange work on itself without disturbing the user typing
+ *
+ * @override
+ */
+ reset: function (record, event) {
+ this._reset(record, event);
+ if (event && event.target === this) {
+ return $.when();
+ } else {
+ return this._render();
+ }
+ },
+
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------