diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-03-13 13:51:07 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 26f91c429cd5dac112e74793c43b828872a90051 (patch) | |
| tree | da834935b6f7ff809057affc531cabdc9bf71eea /addons/web/static/src | |
| parent | aa371a3eff34ce7da89e80582f1c78a9b9f23674 (diff) | |
[FIX] web: cannot debounce prototype function of Widget
The `_onClickStage` method of the `FieldStatus` was debounced. This can
be done but not directly on prototype functions because they are shared
between each instances (just called with different `this`). This does
not produced any bug because there never are two instances of this
class which are used at the same time in the web client. The problem is
however present when trying to make tests as clicks on different
statusbar buttons in two different tests were filtered by the
debouncing.
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 4663c40f755..aec966f438c 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1178,6 +1178,7 @@ var FieldStatus = AbstractField.extend({ init: function () { this._super.apply(this, arguments); this._setState(); + this._onClickStage = _.debounce(this._onClickStage, 300, true); // TODO maybe not useful anymore ? }, //-------------------------------------------------------------------------- @@ -1246,14 +1247,13 @@ var FieldStatus = AbstractField.extend({ /** * Called when on status stage is clicked -> sets the field value. - * Note: this function is debounced... * * @private * @param {MouseEvent} e */ - _onClickStage: _.debounce(function (e) { + _onClickStage: function (e) { this._setValue($(e.currentTarget).data("value")); - }, 300, true), + }, }); /** |
