From 8e18dbde94d863c65c9f3393e002c44eb7e1ce89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Mon, 23 Mar 2020 15:06:11 +0100 Subject: [PATCH] [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. --- web_widget_numeric_step/__manifest__.py | 2 +- web_widget_numeric_step/i18n/fr.po | 7 +++++++ .../i18n/web_widget_numeric_step.pot | 7 +++++++ .../static/src/js/numeric_step.js | 12 ++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/web_widget_numeric_step/__manifest__.py b/web_widget_numeric_step/__manifest__.py index 06c7375ea..03e9f08b0 100644 --- a/web_widget_numeric_step/__manifest__.py +++ b/web_widget_numeric_step/__manifest__.py @@ -5,7 +5,7 @@ { 'name': "Web Widget Numeric Step", 'category': "web", - 'version': "12.0.1.1.2", + 'version': "12.0.1.1.3", 'author': "GRAP, Tecnativa, " "Odoo Community Association (OCA)", 'license': 'AGPL-3', diff --git a/web_widget_numeric_step/i18n/fr.po b/web_widget_numeric_step/i18n/fr.po index 86941b67d..5108f7da6 100644 --- a/web_widget_numeric_step/i18n/fr.po +++ b/web_widget_numeric_step/i18n/fr.po @@ -29,3 +29,10 @@ msgstr "Moins" #, python-format msgid "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 "" diff --git a/web_widget_numeric_step/i18n/web_widget_numeric_step.pot b/web_widget_numeric_step/i18n/web_widget_numeric_step.pot index dd11a5bc9..93c1d8c42 100644 --- a/web_widget_numeric_step/i18n/web_widget_numeric_step.pot +++ b/web_widget_numeric_step/i18n/web_widget_numeric_step.pot @@ -27,3 +27,10 @@ msgstr "" msgid "Plus" 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 "" + diff --git a/web_widget_numeric_step/static/src/js/numeric_step.js b/web_widget_numeric_step/static/src/js/numeric_step.js index bac11eabe..0b425d209 100644 --- a/web_widget_numeric_step/static/src/js/numeric_step.js +++ b/web_widget_numeric_step/static/src/js/numeric_step.js @@ -53,6 +53,7 @@ odoo.define('web_widget_numeric_step.field', function (require) { this._lazyOnChangeTrigger = _.debounce(function() { self.$input.trigger("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) { - this._interval = setTimeout( - $.proxy(this, "_whileMouseDown", ev), this._click_delay); + if (!this._auto_step_interval) { + this._auto_step_interval = setTimeout( + $.proxy(this, "_whileMouseDown", ev), this._click_delay); + } }, _onMouseUp: function () { - clearTimeout(this._interval); - this._interval = false; + clearTimeout(this._auto_step_interval); + this._auto_step_interval = false; 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._auto_step_interval = false; this._onStepMouseDown(ev); },