[FIX] point_of_sale: fix numpad handling

The numpad in the PoS was sometimes handling events when it was not
supposed to, leading to unexpected behavior. This was due to the fact
we did not check if there was a buffer holder for the numpad before
triggering the event handler. The check is now done by adding a check
in the _onKeyboardInput method.

closes odoo/odoo#159951

X-original-commit: d05220d797978b5f31f574c532c6a5a117b9f5b9
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Adrien Guilliams (adgu)
2024-04-02 08:41:50 +00:00
parent 6418638662
commit 6768cf0613
@@ -161,7 +161,10 @@ class NumberBuffer extends EventBus {
: 0;
}
_onKeyboardInput(event) {
return this._bufferEvents(this._onInput((event) => event.key))(event);
return (
this._currentBufferHolder &&
this._bufferEvents(this._onInput((event) => event.key))(event)
);
}
sendKey(key) {
const event = new CustomEvent("", {