Skip to content

Commit

Permalink
[MIG] web_widget_numeric_step: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosRoca13 committed Jan 8, 2025
1 parent 0889f10 commit e3e7acc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
Binary file removed web_pivot_computed_measure.zip
Binary file not shown.
16 changes: 8 additions & 8 deletions web_widget_numeric_step/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,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/17.0/web_widget_numeric_step
:target: https://github.com/OCA/web/tree/18.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-17-0/web-17-0-web_widget_numeric_step
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_numeric_step
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -89,17 +89,17 @@ You can test the feature by going to Settings > Technical > Scheduled
Actions. The field "Execute Every" is configured to use the widget with
2 step, min to 0 and max to 40.

.. |image1| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/add_two_buttons.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/step0,25andlimits.gif
.. |image3| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/add_two_buttons.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/step0,25andlimits.gif
.. |image3| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_numeric_step%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_numeric_step%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -152,6 +152,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rafaelbn| |maintainer-yajo|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_widget_numeric_step>`_ project on GitHub.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_widget_numeric_step>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion web_widget_numeric_step/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Web Widget Numeric Step",
"category": "web",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"author": "GRAP, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/web",
Expand Down
12 changes: 6 additions & 6 deletions web_widget_numeric_step/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Web Widget Numeric Step</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1062d0c26bb10198c524113d70fa069c5928514e9569f607316544fee88bb6d9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_widget_numeric_step"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_numeric_step"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/18.0/web_widget_numeric_step"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_numeric_step"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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 <tt class="docutils literal">min</tt>, <tt class="docutils literal">max</tt>, <tt class="docutils literal">step</tt>,
Expand All @@ -394,7 +394,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>In your xml view, add <tt class="docutils literal"><span class="pre">widget=&quot;numeric_step&quot;</span></tt> This will add the 2
buttons “+” and “-” just next to the input field in edit mode. Iteration
step by default is 1.</p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/add_two_buttons.png" /></p>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/add_two_buttons.png" /></p>
<p><strong>Optional</strong></p>
<p>Add an option to choose the step iteration and limits (min and max
values).</p>
Expand All @@ -415,9 +415,9 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Iteration with 0.25 step, min to -1 and max to 10.</p>
<p>Start to increment with button, continue incrementing with scrolling
mouse.</p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/step0,25andlimits.gif" /></p>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/step0,25andlimits.gif" /></p>
<p>Iteration with 10 step, max limit 15, placeholder with onchange</p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/web/17.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif" /></p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/web/18.0/web_widget_numeric_step/static/description/step10_limit15_placeholder117_with_onchange.gif" /></p>
<p><strong>Demo</strong></p>
<p>You can test the feature by going to Settings &gt; Technical &gt; Scheduled
Actions. The field “Execute Every” is configured to use the widget with
Expand All @@ -428,7 +428,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_numeric_step%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_numeric_step%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -468,7 +468,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/rafaelbn"><img alt="rafaelbn" src="https://github.com/rafaelbn.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_widget_numeric_step">OCA/web</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/18.0/web_widget_numeric_step">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
23 changes: 16 additions & 7 deletions web_widget_numeric_step/static/src/numeric_step.esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @odoo-module */

import {_lt} from "@web/core/l10n/translation";
import {_t} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {FloatField} from "@web/views/fields/float/float_field";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
Expand All @@ -10,7 +10,7 @@ export class NumericStep extends FloatField {
super.setup();
}
_onStepClick(ev) {
const mode = $(ev.target).data("mode");
const mode = ev.target.dataset.mode;
this._doStep(mode);
}
_onKeyDown(ev) {
Expand All @@ -22,10 +22,19 @@ export class NumericStep extends FloatField {
}
_onWheel(ev) {
ev.preventDefault();
if (ev.deltaY > 0) {
this._doStep("minus");
} else {
this._doStep("plus");
if (!this._lastWheelTime) {
this._lastWheelTime = 0;
}
const now = Date.now();
const throttleLimit = 100;
if (now - this._lastWheelTime >= throttleLimit) {
this._lastWheelTime = now;

if (ev.deltaY > 0) {
this._doStep("minus");
} else {
this._doStep("plus");
}
}
}
updateField(val) {
Expand Down Expand Up @@ -64,7 +73,7 @@ NumericStep.defaultProps = {
export const numericStep = {
component: NumericStep,
supportedTypes: ["float"],
displayName: _lt("Numeric Step"),
displayName: _t("Numeric Step"),
extractProps: ({attrs, options}) => {
return {
name: attrs.name,
Expand Down
2 changes: 1 addition & 1 deletion web_widget_numeric_step/static/src/numeric_step.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright 2020 Tecnativa - Alexandre Díaz
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<template>
<t t-name="web_widget_numeric_step" owl="1">
<t t-name="web_widget_numeric_step">
<div class="d-flex widget_numeric_step">
<div class="input-group-prepend widget_numeric_step_btn">
<button
Expand Down

0 comments on commit e3e7acc

Please sign in to comment.