From 6768cf06138bb5c94a6c77db79ed5d802333b290 Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Thu, 28 Mar 2024 10:38:47 +0100 Subject: [PATCH] [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) --- .../static/src/app/utils/number_buffer_service.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/app/utils/number_buffer_service.js b/addons/point_of_sale/static/src/app/utils/number_buffer_service.js index d2c7be2f0f1..d1a68f0e497 100644 --- a/addons/point_of_sale/static/src/app/utils/number_buffer_service.js +++ b/addons/point_of_sale/static/src/app/utils/number_buffer_service.js @@ -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("", {