mirror of https://github.com/OCA/web.git
[IMP] synchronize searches
parent
71210c651b
commit
fac5e8873a
|
@ -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,23 +29,26 @@ 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.view.dataset._model.call(
|
return self.autocomplete_mutex.exec(function()
|
||||||
'search_count', [domain.eval()])
|
{
|
||||||
.then(function(count)
|
return self.view.dataset._model.call(
|
||||||
{
|
'search_count', [domain.eval()])
|
||||||
if(count)
|
.then(function(count)
|
||||||
{
|
{
|
||||||
_.each(data, function(obj)
|
if(count)
|
||||||
{
|
{
|
||||||
obj.label += _.str.sprintf(' (%s)', count);
|
_.each(data, function(obj)
|
||||||
});
|
{
|
||||||
return data;
|
obj.label += _.str.sprintf(' (%s)', count);
|
||||||
}
|
});
|
||||||
else
|
return data;
|
||||||
{
|
}
|
||||||
return null;
|
else
|
||||||
}
|
{
|
||||||
});
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.web.search.CharField.include({
|
instance.web.search.CharField.include({
|
||||||
|
|
Loading…
Reference in New Issue