openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #26609
[Bug 1200646] Re: (point of sale) very slow search with a barcode scanner
I think you did not read my report carefully and you did not test in a real case,
I mean:
1) with a real barcode scanner
2) with 2 ou 3000 product.
If you test with only a few tenths of products, you cannot see the
issue. Eventually, the problem is not the difference between 0.5 and
4seconds, the problem comes from the fact the full search is triggered
FOR EACH KEYPRESS.
With the current situation, if a search actually takes 4 seconds and you type 5 letters, the full search will take 20 seconds. We encounter this in a real case situation with 4 shops in production, the system is just unusable.
If you apply the patch, the full search will take only 4 seconds, because the search will be triggered *after* you finish typing.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1200646
Title:
(point of sale) very slow search with a barcode scanner
Status in OpenERP Addons (modules):
New
Bug description:
In the point of sale, when searching a product with a barcode scanner,
the search is triggered after a few seconds, making it a real pain for
real life use.
The reason is that the search is triggered immediately after a key is
pressed. Since a barcode scanner acts like a simple keyboard, the
search is triggered as many times as the number of letter of the
barcode. If a simple search takes 400ms and the barcode contains 10
characters, it means the user must wait 4 seconds for the product to
be displayed.
The fix is to add a 200ms delay after a keyup() so that the search is
triggered only after the delay.
Add this function somewhere so that the keyupDelay() function be
available (for example on top of the pos widgets.js file) :
jQuery.fn.keyupDelay = function(delay, cb){
if(delay == null){
delay = 200;
}
var timer = 0;
var el = $(this);
return $(this).on('keyup',function(){
clearTimeout(timer);
timer = setTimeout(function(){cb(el)} , delay );
});
}
Then replace these two lines in widgets.js :
this.$('.searchbox input').keyup(function(){
query = $(this).val().toLowerCase();
with :
this.$('.searchbox input').keyupDelay(200, function(el){
query = el.val().toLowerCase();
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1200646/+subscriptions