mirror of https://github.com/OCA/web.git
[ADD] make prefetch timeout configurable
parent
66c70fffbe
commit
08b3b724f0
|
@ -12,7 +12,6 @@ term in the background and only offers an option if this search has a result.
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
* go to ...
|
|
||||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
:target: https://runbot.odoo-community.org/runbot/162/8.0
|
:target: https://runbot.odoo-community.org/runbot/162/8.0
|
||||||
|
@ -26,11 +25,17 @@ Known issues / Roadmap
|
||||||
|
|
||||||
* some searches (especially via function fields) can be very heavy on the
|
* some searches (especially via function fields) can be very heavy on the
|
||||||
server.
|
server.
|
||||||
|
|
||||||
To disable prefetching on a per field basis, set the option
|
To disable prefetching on a per field basis, set the option
|
||||||
`web_search_autocomplete_prefetch.disable`::
|
`web_search_autocomplete_prefetch.disable`::
|
||||||
|
|
||||||
options="{'web_search_autocomplete_prefetch.disable': true}"
|
options="{'web_search_autocomplete_prefetch.disable': true}"
|
||||||
|
|
||||||
on your field in the search view.
|
on your field in the search view.
|
||||||
|
* by default, the addon triggers a search 350 milliseconds after the last key
|
||||||
|
pess. If you want a different timeout, set the parameter
|
||||||
|
``web_search_autocomplete_prefetch.keypress_timeout`` to the amount of
|
||||||
|
milliseconds you need as timeout.
|
||||||
|
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
@ -85,6 +85,23 @@ openerp.web_search_autocomplete_prefetch = function(instance)
|
||||||
|
|
||||||
instance.web.search.AutoComplete.include({
|
instance.web.search.AutoComplete.include({
|
||||||
keypress_timeout: 350,
|
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()
|
select_item: function()
|
||||||
{
|
{
|
||||||
if(!this.current_result)
|
if(!this.current_result)
|
||||||
|
|
Loading…
Reference in New Issue