|
|
@ -84,6 +84,24 @@ openerp.web_search_autocomplete_prefetch = function(instance) |
|
|
|
}); |
|
|
|
|
|
|
|
instance.web.search.AutoComplete.include({ |
|
|
|
keypress_timeout: 350, |
|
|
|
start: function() |
|
|
|
{ |
|
|
|
var self = this; |
|
|
|
return jQuery.when( |
|
|
|
this._super.apply(this, arguments), |
|
|
|
new instance.web.Model('ir.config_parameter').call( |
|
|
|
'get_param', |
|
|
|
[ |
|
|
|
'web_search_autocomplete_prefetch.keypress_timeout', |
|
|
|
this.keypress_timeout |
|
|
|
] |
|
|
|
).then(function(keypress_timeout) |
|
|
|
{ |
|
|
|
self.keypress_timeout = parseInt(keypress_timeout); |
|
|
|
}) |
|
|
|
); |
|
|
|
}, |
|
|
|
select_item: function() |
|
|
|
{ |
|
|
|
if(!this.current_result) |
|
|
@ -92,5 +110,18 @@ openerp.web_search_autocomplete_prefetch = function(instance) |
|
|
|
} |
|
|
|
return this._super.apply(this, arguments); |
|
|
|
}, |
|
|
|
initiate_search: function(query) |
|
|
|
{ |
|
|
|
var self = this, |
|
|
|
_super = this._super, |
|
|
|
last_timeout = null; |
|
|
|
this.last_timeout = last_timeout = window.setTimeout(function() |
|
|
|
{ |
|
|
|
if(self.last_timeout == last_timeout) |
|
|
|
{ |
|
|
|
_super.apply(self, [query]); |
|
|
|
} |
|
|
|
}, this.keypress_timeout) |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |