From 0fa7da31685d353e1d397f0f078629447ec9660e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 2 Oct 2012 12:13:53 +0200 Subject: [PATCH] [WIP FIX] point_of_sale: investigating a bug with codebar scanning in subcategories bzr revid: fva@openerp.com-20121002101353-imjbqe1vxtdjbqu7 --- addons/point_of_sale/static/src/js/devices.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 142d35bd340..f998ed334df 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -432,13 +432,13 @@ 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. $('body').delegate('','keyup', function (e){ - + console.log('keyup:'+String.fromCharCode(e.keyCode)+' '+e.keyCode,e); //We only care about numbers - if (!isNaN(Number(String.fromCharCode(e.keyCode)))) { + if (e.keyCode >= 48 && e.keyCode < 58){ // The barcode reader sends keystrokes with a specific interval. // We look if the typed keys fit in the interval. - if (codeNumbers.length==0) { + if (codeNumbers.length === 0) { timeStamp = new Date().getTime(); } else { if (lastTimeStamp + 30 < new Date().getTime()) { @@ -449,7 +449,7 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal } codeNumbers.push(e.keyCode - 48); lastTimeStamp = new Date().getTime(); - if (codeNumbers.length == 13) { + if (codeNumbers.length === 13) { //We have found what seems to be a valid codebar self.on_ean(codeNumbers.join('')); codeNumbers = [];