Problem reading barcodes from POS

Bug #1060087 reported by Francisco Martinez
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Incomplete
Undecided
van der Essen Frédéric (OpenERP)

Bug Description

Hello,
I have encountered a problem while reading barcodes with the barcode scanner in POS module. Here I attach the explanation and the workaround I adopted:

While you are in the main screen of the POS, all works ok, the codes are readed correctly, but when you begin to navigate through the categories and use the scanner to read another code, it returns error messages of unrecognized product.
In my research work, I have see that the problem resides in the keyup capture event from jQuery:

$('body').delegate('','keyup', function (e){

This function is executed every time you navigate through categories, and repeat the keyup event as categories "clicks" you have entered. I.E.: if you navigate with the categories buttons, and have a category tree with a 3 level depth, when you are in the third level and read a barcode, it's readed for three times, causing an unrecognized product error.
I can't solve with the event.stopPropagation() or event.preventDefault() directives. The workaround that I have applied is changing the jQuery event with the onkeyup JavaScript event, which don't inherit the capture event for more than one time:

     $("input#barras")[0].onkeyup = function(e) {

With the [0] tag we only select the first of all captured keyups at the same time.
I need to include an input textbox where write the barcode. It helps to the clerks to show the barcode readed, and they can write the code by hand.
Also, I reduced the filter to catch the keycodes by the following line:

if (e.keyCode >= 48 && e.keyCode <= 58) {

It's a simple method cleaner than the earlier. With this filter the 13 (enter) code sended by the scanner.

And this is the line in pos.xml to generate the textbox:

<td>Product<a> EAN: <input id='barras' type='text' style='text-align:center; height:20px; width:95px; font-size:12px' /></a></td>

Regards
Fran

Changed in openerp-web:
assignee: nobody → van der Essen Frédéric (OpenERP) (fva-openerp)
status: New → Incomplete
affects: openerp-web → openobject-addons
Revision history for this message
van der Essen Frédéric (OpenERP) (fva-openerp) wrote :

Hi, thank you for the bug report !
I Have trouble reproducing it tough, Can you be more precise in what version of OpenERP, what os and what browser (and wich version) are you using ?

Revision history for this message
Francisco Martinez (pxntium) wrote : Re: [Bug 1060087] Re: Problem reading barcodes from POS

Hi,
sorry :)

The OpenERP version is 6.1 and the browsers tested are Chrome 21 & 22 and
Firefox last version.

If you need more information, feel free to mail me.

Regards!
Fco.

2012/10/2 van der Essen Frédéric (OpenERP) <email address hidden>

> Hi, thank you for the bug report !
> I Have trouble reproducing it tough, Can you be more precise in what
> version of OpenERP, what os and what browser (and wich version) are you
> using ?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1060087
>
> Title:
> Problem reading barcodes from POS
>
> Status in OpenERP Addons (modules):
> Incomplete
>
> Bug description:
> Hello,
> I have encountered a problem while reading barcodes with the barcode
> scanner in POS module. Here I attach the explanation and the workaround I
> adopted:
>
> While you are in the main screen of the POS, all works ok, the codes are
> readed correctly, but when you begin to navigate through the categories and
> use the scanner to read another code, it returns error messages of
> unrecognized product.
> In my research work, I have see that the problem resides in the keyup
> capture event from jQuery:
>
> $('body').delegate('','keyup', function (e){
>
> This function is executed every time you navigate through categories,
> and repeat the keyup event as categories "clicks" you have entered. I.E.:
> if you navigate with the categories buttons, and have a category tree with
> a 3 level depth, when you are in the third level and read a barcode, it's
> readed for three times, causing an unrecognized product error.
> I can't solve with the event.stopPropagation() or event.preventDefault()
> directives. The workaround that I have applied is changing the jQuery event
> with the onkeyup JavaScript event, which don't inherit the capture event
> for more than one time:
>
> $("input#barras")[0].onkeyup = function(e) {
>
> With the [0] tag we only select the first of all captured keyups at the
> same time.
> I need to include an input textbox where write the barcode. It helps to
> the clerks to show the barcode readed, and they can write the code by hand.
> Also, I reduced the filter to catch the keycodes by the following line:
>
> if (e.keyCode >= 48 && e.keyCode <= 58) {
>
> It's a simple method cleaner than the earlier. With this filter the 13
> (enter) code sended by the scanner.
>
> And this is the line in pos.xml to generate the textbox:
>
> <td>Product<a> EAN: <input id='barras' type='text' style='text-
> align:center; height:20px; width:95px; font-size:12px' /></a></td>
>
>
> Regards
> Fran
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-addons/+bug/1060087/+subscriptions
>

Revision history for this message
Robin (ra773) wrote :

Hey Fran

I also have this issue, thanks for the research you have already done on this.

I am using OpenERP 6.1.1 on Ubuntu 12.04
Any browser gives the error
We have multiple level POS categories
We have 2400 products, 1200 on POS and the other 1200 on Magento with some interlinked

I wasn't able to successfully track the issue to this, so thanks Fran for pointing me in the right direction.

9 times out of 10 when scanning a product with the bar code reader, I get the error that it can not find the product. Then every so often it will manage to find the product and add it to the order, but its rare!

Fran could you possibly let me know the other files you amended to get the temporary fix?

Revision history for this message
Robin (ra773) wrote :

I can now confirm that this is happening to me, everything runs smoothly everything scans until you go into a category.

I have categories with 5 deep. If I don't go into categories I don't get the error can't find product.

Any suggestions on a temporary fix.

Thanks
Robin

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.