diff --git a/addons/stock/static/src/widgets/counted_quantity_widget.js b/addons/stock/static/src/widgets/counted_quantity_widget.js index a25421ca9a4..2237f3e44ad 100644 --- a/addons/stock/static/src/widgets/counted_quantity_widget.js +++ b/addons/stock/static/src/widgets/counted_quantity_widget.js @@ -2,6 +2,7 @@ import { FloatField, floatField } from "@web/views/fields/float/float_field"; import { registry } from "@web/core/registry"; +import { getActiveHotkey } from "@web/core/hotkeys/hotkey_service"; const { useEffect, useRef } = owl; @@ -16,8 +17,10 @@ export class CountedQuantityWidgetField extends FloatField { (inputEl) => { if (inputEl) { inputEl.addEventListener("input", this.onInput.bind(this)); + inputEl.addEventListener("keydown", this.onKeydown.bind(this)); return () => { inputEl.removeEventListener("input", this.onInput.bind(this)); + inputEl.removeEventListener("keydown", this.onKeydown.bind(this)); }; } }, @@ -30,6 +33,12 @@ export class CountedQuantityWidgetField extends FloatField { return this.props.record.update({ inventory_quantity_set: true }); } + onKeydown(ev) { + const hotkey = getActiveHotkey(ev); + if (["enter", "tab", "shift+tab"].includes(hotkey)) + this.onInput(ev) + } + get formattedValue() { if ( this.props.readonly &&