From 3be327c0aef39ce2dfbdd312a9ff1e4488cbf452 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 9 Dec 2013 15:56:52 +0100 Subject: [PATCH] [FIX] point_of_sale: ignore TOTAlY returns Returns were partially ignored when typing keystrokes, thanks to a return; when event which equaled 13, but the default behaviour (press on the focused input/button) was not prevented. This is now the case thanks to preventDefault. For instance, just after a discount set, the focused input was pressed and the associated value was added when scanning a new product with the scanner. Therefore, if we entered a discount of 30%, scanning a new product added '0', the last pushed button, to the discount, and then added the product. bzr revid: dle@openerp.com-20131209145652-3g9rgnfz1w8k0whw --- addons/point_of_sale/static/src/js/devices.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 0326d71d792..cdd24156c30 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -438,6 +438,10 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal // The barcode readers acts as a keyboard, we catch all keyup events and try to find a // barcode sequence in the typed keys, then act accordingly. this.handler = function(e){ + if(e.which === 13){ //ignore returns + e.preventDefault(); + return; + } //We only care about numbers if (e.which >= 48 && e.which < 58){