From 11ae103e122a2ed4f31be5e18154d4692e4be177 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 27 Nov 2017 14:02:21 -0800 Subject: [PATCH] [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 --- addons/point_of_sale/static/src/js/screens.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 013973cbbfc..788276ea957 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -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); });