Skip to content

[20.0][MIG] web_widget_numeric_step: Migration to 20.0 - #3761

Open
CarlosRoca13 wants to merge 38 commits into
OCA:20.0from
Tecnativa:20.0-mig-web_widget_numeric_step
Open

CarlosRoca13 wants to merge 38 commits into
OCA:20.0from
Tecnativa:20.0-mig-web_widget_numeric_step

Conversation

@CarlosRoca13

Copy link
Copy Markdown
Contributor

@OCA-git-bot OCA-git-bot added mod:web_widget_numeric_step Module web_widget_numeric_step series:20.0 labels Oct 28, 2026
quentinDupont and others added 28 commits October 28, 2026 11:10
Previous this commit the widget only works with 'dots', with
this commit works using odoo parse method that support other separators.
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.
Currently translated at 100.0% (3 of 3 strings)

Translation: web-16.0/web-16.0-web_widget_numeric_step
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_numeric_step/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: web-16.0/web-16.0-web_widget_numeric_step
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_numeric_step/it/
Mobile screens benefit most from this module's enhanced usability.

However, since the events used for displaying/hiding the +/- buttons depend on mouse, at the end you'll never see these buttons on mobile screens.

Thus, here's a new approach: smaller screens *always* display the buttons.

Besides, inputmode is now decimal, just like upstream float fields.

@moduon MT-4396
Before this patch, if a field was readonly, the user could still use the +/- buttons to alter its value. Not good!

@moduon MT-4396
… layout jumping otherwise

Before this patch:
- On a tablet, buttons wouldn't display (big screen; can't hover).
- On a PC, fields would make layout jumps while hovering.

@moduon MT-4472
If you're using a tablet and click on the ➕ or ➖ buttons created by this module, the result was that the numeric input related to that button got focused.

On tablets, that means that the on-screen keyboard pops up. This usually triggers a layout recalculation and becomes clunky. Besides, it's useless, because if you wanted to use the keyboard, you'd have clicked on the input by yourself, and not in one of those buttons.

After this change, when using a touch screen, if you click on the +/- buttons, you won't auto-focus on the input. Thus, the keyboard won't show up.

@moduon MT-4472
Before this patch, when navigating inputs hitting <kbd>TAB</kbd>, you were stopped before any numeric step input.

Now, you can navigate as usual and use Odoo without a 🐁.

@moduon MT-4657
Default width is too narrow for these fields in list views, which makes it uncomfortable to use in desktops.

@moduon MT-4472
achulii and others added 9 commits October 28, 2026 11:10
…ing effect

The focus introduced on the 16.0 migration is causing a flickering effect
that is a bit annoying and does not make complete sense, because if you
click more than once the cursor is positioned at the end of the text,
which makes it difficult to edit the input.

The counterpart of these changes is that to edit the input using the
keyboard we will have to click on the field. Although this is how the
module has been operating since its inception.
If we set a class in the field it will get to the widget template.

TT54358
@CarlosRoca13
CarlosRoca13 force-pushed the 20.0-mig-web_widget_numeric_step branch from d4e4839 to d9b8d3c Compare October 28, 2026 10:10
@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot migration web_widget_numeric_step

@OCA-git-bot OCA-git-bot added this to the 20.0 milestone Oct 28, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Oct 28, 2026
5 of 36 tasks
@CarlosRoca13
CarlosRoca13 force-pushed the 20.0-mig-web_widget_numeric_step branch from d9b8d3c to 9b1ec51 Compare October 28, 2026 10:21
Comment on lines +7 to +9
<field name="interval_number" position="attributes">
<attribute name="widget">numeric_step</attribute>
<attribute name="options">{'step': 2, 'min': 0, 'max': 40}</attribute>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick :)

This field is an integer, so the effect on it is that it's showed as float.

Image

Maybe add a roadmap entry indicating this known issue or even probable future support.

In the other hand, you can use some of the paper format margin fields for the demo data, which are real floats and are available in web

number, so you can use the options `min`, `max`, `step`, `placeholder`.

Demo available at Settings \> Users & Companies \> Users \> \*Select
One\* \> See 'Credit Limit' field

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This README is outdated: this field has never belonged to ir.cron. Please update it.

updateField(val) {
return this.props.record.update({[this.props.name]: val});
}
_doStep(mode) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't update the field in the view if it's read-only, because when the record is saved, the field is restored to its original value, which is a bad experience for the user. Could you handle this, or add it to the ROADMAP?

2026-10-28.13-49-13.mp4

@CarlosRoca13
CarlosRoca13 force-pushed the 20.0-mig-web_widget_numeric_step branch from 9b1ec51 to c6ba58e Compare October 29, 2026 06:22
@oca-cla-bot

oca-cla-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

@CarlosRoca13

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews, @chienandalu and @carlos-lopez-tecnativa! Changes applied

The widget now supports integer fields properly. I have moved too the demo data to paperformat. Finally, on a readonly field the widget now renders only the formatted value, like the core float field.

@chienandalu chienandalu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Code and test review 👍 Thanks!

@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 20.0-ocabot-merge-pr-3761-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

It looks like something changed on 20.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 20.0-ocabot-merge-pr-3761-by-pedrobaeza-bump-nobump, awaiting test results.

2 similar comments
@OCA-git-bot

Copy link
Copy Markdown
Contributor

It looks like something changed on 20.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 20.0-ocabot-merge-pr-3761-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

It looks like something changed on 20.0 in the meantime.
Let me try again (no action is required from you).
Prepared branch 20.0-ocabot-merge-pr-3761-by-pedrobaeza-bump-nobump, awaiting test results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.