Browse Source

[IMP] synchronize searches

pull/271/head
Holger Brunn 9 years ago
parent
commit
dee2846156
  1. 7
      web_search_autocomplete_prefetch/static/src/js/web_search_autocomplete_prefetch.js

7
web_search_autocomplete_prefetch/static/src/js/web_search_autocomplete_prefetch.js

@ -11,6 +11,10 @@ openerp.web_search_autocomplete_prefetch = function(instance)
{ {
return data; return data;
} }
if(!self.autocomplete_mutex)
{
self.autocomplete_mutex = new instance.Mutex()
}
var facet = { var facet = {
get: function(name) get: function(name)
{ {
@ -25,6 +29,8 @@ openerp.web_search_autocomplete_prefetch = function(instance)
self.get_domain({values: [facet]}), self.get_domain({values: [facet]}),
self.view.dataset.domain); self.view.dataset.domain);
domain.set_eval_context(self.view.dataset.get_context()); domain.set_eval_context(self.view.dataset.get_context());
return self.autocomplete_mutex.exec(function()
{
return self.view.dataset._model.call( return self.view.dataset._model.call(
'search_count', [domain.eval()]) 'search_count', [domain.eval()])
.then(function(count) .then(function(count)
@ -42,6 +48,7 @@ openerp.web_search_autocomplete_prefetch = function(instance)
return null; return null;
} }
}); });
});
} }
instance.web.search.CharField.include({ instance.web.search.CharField.include({

Loading…
Cancel
Save