Browse Source

[ADD] Search Bar For Quotation

pull/30/merge
SHEREEF PT 8 years ago
parent
commit
75555f35c5
  1. 2
      pos_quotation_order/__manifest__.py
  2. 35
      pos_quotation_order/static/src/js/pos_quotation.js

2
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",

35
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;
},
});

Loading…
Cancel
Save