← Back to team overview

openerp-india team mailing list archive

[Bug 1200646] Re: (point of sale) very slow search with a barcode scanner

 

Thanks Van,

For your comment on this, let me confirm it based on your last comment.

** Changed in: openobject-addons
   Importance: Undecided => Medium

** Changed in: openobject-addons
       Status: Triaged => Confirmed

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 3 (openerp-dev-addons3)

-- 
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):
  Confirmed

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