diff --git a/pos_quotation_order/__manifest__.py b/pos_quotation_order/__manifest__.py index 875bcd703..610409815 100644 --- a/pos_quotation_order/__manifest__.py +++ b/pos_quotation_order/__manifest__.py @@ -22,7 +22,7 @@ ############################################################################# { 'name': "Pos Quotation Orders", - 'version': '10.0.1.0.0', + 'version': '10.0.2.0.0', 'summary': """Create & Process Quotation from POS""", 'description': """This module allows to create and process quotation orders from POS.""", 'author': "Cybrosys Techno Solutions", diff --git a/pos_quotation_order/static/src/js/pos_quotation.js b/pos_quotation_order/static/src/js/pos_quotation.js index c2ec9245a..8337772c4 100644 --- a/pos_quotation_order/static/src/js/pos_quotation.js +++ b/pos_quotation_order/static/src/js/pos_quotation.js @@ -133,7 +133,7 @@ var QuotationListScreenWidget = ScreenWidget.extend({ this.chrome.widget.keyboard.connect(this.$('.searchbox input')); } - this.$('.searchbox input').on('keypress',function(event){ + this.$('.searchbox input').on('keyup',function(event){ clearTimeout(search_timeout); var query = this.value; search_timeout = setTimeout(function(){ @@ -183,6 +183,39 @@ var QuotationListScreenWidget = ScreenWidget.extend({ } }, + + perform_search: function(query, associate_result){ + var quotations; + if(query){ + quotations = this.search_quotation(query); + this.render_list(quotations); + }else{ + quotations = this.pos.quotations; + this.render_list(quotations); + } + }, + clear_search: function(){ + var quotations = this.pos.quotations; + this.render_list(quotations); + this.$('.searchbox input')[0].value = ''; + this.$('.searchbox input').focus(); + }, + + search_quotation: function(query){ + try { + var re = RegExp(query); + }catch(e){ + return []; + } + var results = []; + for (var quot_id in this.pos.quotations){ + var r = re.exec(this.pos.quotations[quot_id]['name']); + if(r){ + results.push(this.pos.quotations[quot_id]); + } + } + return results; + }, });