[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.
This commit is contained in:
qsm-odoo
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent aa371a3eff
commit 26f91c429c
@@ -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),
},
});
/**