[FIX] point_of_sale: search customers with full search query

When the keypress handler is called the pressed key has not yet been
added to this.value. This leads to the search being performed with
e.g. 'Agr' when the user has typed 'Agro'.

Fix this by getting this value when the timeout expires. At this point
the value will be updated.

Fixes #21129
This commit is contained in:
Joren Van Onder
2017-11-27 16:03:47 -08:00
parent ccaced9292
commit 11ae103e12
@@ -1018,10 +1018,10 @@ var ClientListScreenWidget = ScreenWidget.extend({
this.$('.searchbox input').on('keypress',function(event){
clearTimeout(search_timeout);
var query = this.value;
var searchbox = this;
search_timeout = setTimeout(function(){
self.perform_search(query,event.which === 13);
self.perform_search(searchbox.value, event.which === 13);
},70);
});