3
0
Fork 0

[FIX] web_widget_numeri_step: Change click interval

Previous this commit, the task for auto-step can enter in a
infinite loop. Now only creates a new task if no other task is running.
14.0
Alexandre Díaz 2020-03-23 15:06:11 +01:00 committed by hkapatel
parent 36d5b88354
commit 32247bdb87
4 changed files with 23 additions and 5 deletions

View File

@ -5,7 +5,7 @@
{ {
'name': "Web Widget Numeric Step", 'name': "Web Widget Numeric Step",
'category': "web", 'category': "web",
'version': "12.0.1.1.2", 'version': "12.0.1.1.3",
'author': "GRAP, Tecnativa, " 'author': "GRAP, Tecnativa, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -29,3 +29,10 @@ msgstr "Moins"
#, python-format #, python-format
msgid "Plus" msgid "Plus"
msgstr "Plus" msgstr "Plus"
#. module: web_widget_numeric_step
#. openerp-web
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:16
#, python-format
msgid "Value"
msgstr ""

View File

@ -27,3 +27,10 @@ msgstr ""
msgid "Plus" msgid "Plus"
msgstr "" msgstr ""
#. module: web_widget_numeric_step
#. openerp-web
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:16
#, python-format
msgid "Value"
msgstr ""

View File

@ -53,6 +53,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
this._lazyOnChangeTrigger = _.debounce(function() { this._lazyOnChangeTrigger = _.debounce(function() {
self.$input.trigger("change"); self.$input.trigger("change");
}, this.DELAY_THROTTLE_CHANGE); }, this.DELAY_THROTTLE_CHANGE);
this._auto_step_interval = false;
}, },
/** /**
@ -164,13 +165,15 @@ odoo.define('web_widget_numeric_step.field', function (require) {
}, },
_onStepMouseDown: function (ev) { _onStepMouseDown: function (ev) {
this._interval = setTimeout( if (!this._auto_step_interval) {
$.proxy(this, "_whileMouseDown", ev), this._click_delay); this._auto_step_interval = setTimeout(
$.proxy(this, "_whileMouseDown", ev), this._click_delay);
}
}, },
_onMouseUp: function () { _onMouseUp: function () {
clearTimeout(this._interval); clearTimeout(this._auto_step_interval);
this._interval = false; this._auto_step_interval = false;
this._click_delay = this.DEF_CLICK_DELAY; this._click_delay = this.DEF_CLICK_DELAY;
}, },
@ -182,6 +185,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
this._click_delay -= this.SUBSTRACT_DELAY_STEP; this._click_delay -= this.SUBSTRACT_DELAY_STEP;
} }
this._auto_step_interval = false;
this._onStepMouseDown(ev); this._onStepMouseDown(ev);
}, },