diff --git a/web_widget_numeric_step/README.rst b/web_widget_numeric_step/README.rst
index f61c24b4f..d2985fa99 100644
--- a/web_widget_numeric_step/README.rst
+++ b/web_widget_numeric_step/README.rst
@@ -14,13 +14,13 @@ Web Widget Numeric Step
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
- :target: https://github.com/OCA/web/tree/12.0/web_widget_numeric_step
+ :target: https://github.com/OCA/web/tree/13.0/web_widget_numeric_step
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_numeric_step
+ :target: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_widget_numeric_step
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/162/12.0
+ :target: https://runbot.odoo-community.org/runbot/162/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -42,7 +42,7 @@ In your xml view, add ``widget="numeric_step"``
This will add the 2 buttons "+" and "-" just next to the input field in edit mode.
Iteration step by default is 1.
-.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/add_two_buttons.png
+.. figure:: https://raw.githubusercontent.com/OCA/web/13.0/web_widget_numeric_step/static/description/add_two_buttons.png
**Optional**
@@ -61,11 +61,11 @@ Iteration with 0.25 step, min to -1 and max to 10.
Start to increment with button, continue incrementing with scrolling mouse.
-.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/step0,25andlimits.gif
+.. figure:: https://raw.githubusercontent.com/OCA/web/13.0/web_widget_numeric_step/static/description/step0,25andlimits.gif
Iteration with 10 step, max limit 15, placeholder with onchange
-.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif
+.. figure:: https://raw.githubusercontent.com/OCA/web/13.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif
Bug Tracker
===========
@@ -73,7 +73,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -96,6 +96,7 @@ Contributors
* `Tecnativa `_:
* Alexandre Díaz
+ * Carlos Roca
Maintainers
~~~~~~~~~~~
@@ -110,6 +111,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/web `_ project on GitHub.
+This module is part of the `OCA/web `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/web_widget_numeric_step/__manifest__.py b/web_widget_numeric_step/__manifest__.py
index 9ec7a8ba2..56749a57b 100644
--- a/web_widget_numeric_step/__manifest__.py
+++ b/web_widget_numeric_step/__manifest__.py
@@ -5,13 +5,13 @@
{
"name": "Web Widget Numeric Step",
"category": "web",
- "version": "12.0.1.2.0",
+ "version": "13.0.1.0.0",
"author": "GRAP, Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"data": ["view/assets.xml"],
- "qweb": ["static/src/xml/numeric_step.xml",],
+ "qweb": ["static/src/xml/numeric_step.xml"],
"demo": ["demo/res_users_view.xml"],
"auto_install": False,
"installable": True,
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 93c1d8c42..e019674a4 100644
--- a/web_widget_numeric_step/i18n/web_widget_numeric_step.pot
+++ b/web_widget_numeric_step/i18n/web_widget_numeric_step.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * web_widget_numeric_step
+# * web_widget_numeric_step
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -15,22 +15,21 @@ msgstr ""
#. module: web_widget_numeric_step
#. openerp-web
-#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:14
+#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
#, python-format
msgid "Minus"
msgstr ""
#. module: web_widget_numeric_step
#. openerp-web
-#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:19
+#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
#, python-format
msgid "Plus"
msgstr ""
#. module: web_widget_numeric_step
#. openerp-web
-#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:16
+#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
#, python-format
msgid "Value"
msgstr ""
-
diff --git a/web_widget_numeric_step/readme/CONTRIBUTORS.rst b/web_widget_numeric_step/readme/CONTRIBUTORS.rst
index de2b473bd..af20abc90 100644
--- a/web_widget_numeric_step/readme/CONTRIBUTORS.rst
+++ b/web_widget_numeric_step/readme/CONTRIBUTORS.rst
@@ -5,3 +5,4 @@
* `Tecnativa `_:
* Alexandre Díaz
+ * Carlos Roca
diff --git a/web_widget_numeric_step/static/description/index.html b/web_widget_numeric_step/static/description/index.html
index ea4b4c5ed..335d0525b 100644
--- a/web_widget_numeric_step/static/description/index.html
+++ b/web_widget_numeric_step/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This widget changes input number field and make it easier to increment the number thanks to 2 buttons (+ and -).
Use JS native logic for input number, so you can use the options min, max, step, placeholder.
Demo available at Settings > Users & Companies > Users > *Select One* > See ‘Credit Limit’ field
@@ -390,7 +390,7 @@ Use JS native logic for input number, so you can use the options
-
+
Optional
Add an option to choose the step iteration and limits (min and max values).
@@ -402,11 +402,11 @@ Iteration step by default is 1.
Iteration with 0.25 step, min to -1 and max to 10.
Start to increment with button, continue incrementing with scrolling mouse.
Iteration with 10 step, max limit 15, placeholder with onchange
@@ -414,7 +414,7 @@ Iteration step by default is 1.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -435,6 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
Tecnativa:
- Alexandre Díaz
+- Carlos Roca
@@ -446,7 +447,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/web project on GitHub.
+
This module is part of the OCA/web project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
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 a3cd48332..b2c5037f9 100644
--- a/web_widget_numeric_step/static/src/js/numeric_step.js
+++ b/web_widget_numeric_step/static/src/js/numeric_step.js
@@ -5,11 +5,11 @@
odoo.define("web_widget_numeric_step.field", function(require) {
"use strict";
- var field_utils = require("web.field_utils");
- var Registry = require("web.field_registry");
- var FieldFloat = require("web.basic_fields").FieldFloat;
+ const field_utils = require("web.field_utils");
+ const Registry = require("web.field_registry");
+ const FieldFloat = require("web.basic_fields").FieldFloat;
- var NumericStep = FieldFloat.extend({
+ const NumericStep = FieldFloat.extend({
template: "web_widget_numeric_step",
className: "o_field_numeric_step o_field_number",
events: _.extend({}, _.omit(FieldFloat.prototype.events, ["change", "input"]), {
@@ -38,8 +38,8 @@ odoo.define("web_widget_numeric_step.field", function(require) {
this._super.apply(this, arguments);
// Widget config
- var max_val = this.nodeOptions.max;
- var min_val = this.nodeOptions.min;
+ let max_val = this.nodeOptions.max;
+ let min_val = this.nodeOptions.min;
if (
!_.isUndefined(min_val) &&
!_.isUndefined(max_val) &&
@@ -55,10 +55,10 @@ odoo.define("web_widget_numeric_step.field", function(require) {
max: Number(max_val),
};
- var self = this;
- this._lazyOnChangeTrigger = _.debounce(function() {
- self.$input.trigger("change");
- }, this.DELAY_THROTTLE_CHANGE);
+ this._lazyOnChangeTrigger = _.debounce(
+ () => this.$input.trigger("change"),
+ this.DELAY_THROTTLE_CHANGE
+ );
this._auto_step_interval = false;
},
@@ -68,18 +68,13 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @override
*/
start: function() {
- var self = this;
this._click_delay = this.DEF_CLICK_DELAY;
this._autoStep = false;
- return this._super.apply(this, arguments).then(function() {
- document.addEventListener(
- "mouseup",
- $.proxy(self, "_onMouseUp"),
- false
- );
+ return this._super.apply(this, arguments).then(() => {
+ document.addEventListener("mouseup", this._onMouseUp.bind(this), false);
document.addEventListener(
"touchend",
- $.proxy(self, "_onMouseUp"),
+ this._onMouseUp.bind(this),
false
);
});
@@ -103,7 +98,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @override
*/
_parseValue: function() {
- var parsedVal = this._super.apply(this, arguments);
+ const parsedVal = this._super.apply(this, arguments);
if (this.mode === "edit") {
return Number(parsedVal) || 0;
}
@@ -116,7 +111,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @override
*/
_prepareInput: function() {
- var result = this._super.apply(this, arguments);
+ const result = this._super.apply(this, arguments);
this.$input.attr(_.pick(this.nodeOptions, ["placeholder"]));
// InputField hard set the input type to 'text' or 'password',
// we force it again to be 'tel'.
@@ -136,12 +131,10 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @override
*/
_renderEdit: function() {
- _.defer(
- function() {
- this.$el
- .parents("td.o_numeric_step_cell")
- .addClass("numeric_step_editing_cell");
- }.bind(this)
+ _.defer(() =>
+ this.$el
+ .parents("td.o_numeric_step_cell")
+ .addClass("numeric_step_editing_cell")
);
this._prepareInput(this.$el.find("input.input_numeric_step"));
},
@@ -164,11 +157,11 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @param {String} mode can be "plus" or "minus"
*/
_doStep: function(mode) {
- var cval = 0;
+ let cval = 0;
try {
- var field = this.record.fields[this.name];
+ const field = this.record.fields[this.name];
cval = field_utils.parse[field.type](this.$input.val());
- } catch {
+ } catch (e) {
cval = this.value;
mode = false; // Only set the value in this case
}
@@ -177,7 +170,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
} else if (mode === "minus") {
cval -= this._config.step;
}
- var nval = this._sanitizeNumberValue(cval);
+ const nval = this._sanitizeNumberValue(cval);
if (nval !== this.lastSetValue || !mode) {
this.$input.val(nval);
// Every time that user update the value we must trigger an
@@ -203,7 +196,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
*/
_onStepClick: function(ev) {
if (!this._autoStep) {
- var mode = ev.target.dataset.mode;
+ const mode = ev.target.dataset.mode;
this._doStep(mode);
}
this._autoStep = false;
@@ -216,7 +209,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
_onStepMouseDown: function(ev) {
if (ev.button === 0 && !this._auto_step_interval) {
this._auto_step_interval = setTimeout(
- $.proxy(this, "_whileMouseDown", ev),
+ this._whileMouseDown.bind(this, ev),
this._click_delay
);
}
@@ -226,7 +219,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @private
* @param {FocusoutEvent} ev
*/
- _onFocusOut: function(evt) {
+ _onFocusOut: function() {
if (this._auto_step_interval) {
this._clearStepInterval();
}
@@ -245,7 +238,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
*/
_whileMouseDown: function(ev) {
this._autoStep = true;
- var mode = ev.target.dataset.mode;
+ const mode = ev.target.dataset.mode;
this._doStep(mode);
if (this._click_delay > this.MIN_DELAY) {
this._click_delay -= this.SUBSTRACT_DELAY_STEP;
@@ -302,7 +295,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
* @returns {Number}
*/
_sanitizeNumberValue: function(value) {
- var cval = Number(value);
+ let cval = Number(value);
if (_.isNaN(cval)) {
return value;
}
@@ -312,14 +305,14 @@ odoo.define("web_widget_numeric_step.field", function(require) {
cval = this._config.max;
}
- var field = this.record.fields[this.name];
- var formattedValue = field_utils.format[field.type](cval, field, {
+ const field = this.record.fields[this.name];
+ // Formatted value
+ return field_utils.format[field.type](cval, field, {
data: this.record.data,
escape: true,
isPassword: false,
digits: field.digits,
});
- return formattedValue;
},
});