Cache the help with the selection per domain in selection mixin
Closes #15031 (grafted from 1439af7bdd4c87f1bb9761f722c4320e572fde80) --HG-- branch : 8.0
This commit is contained in:
+3
-3
@@ -848,9 +848,9 @@
|
||||
var context = field.get_context(record);
|
||||
var jdomain = JSON.stringify([domain, context]);
|
||||
if (jdomain in this._domain_cache) {
|
||||
let selection = this._domain_cache[jdomain];
|
||||
let [selection, help] = this._domain_cache[jdomain];
|
||||
if (callback) {
|
||||
callback(selection, {});
|
||||
callback(selection, help);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -878,7 +878,7 @@
|
||||
help[x.id] = x[help_field];
|
||||
}
|
||||
}
|
||||
this._domain_cache[jdomain] = selection;
|
||||
this._domain_cache[jdomain] = [selection, help];
|
||||
|
||||
let cur_domain = field.get_domain(record);
|
||||
let cur_context = field.get_context(record);
|
||||
|
||||
@@ -65,7 +65,8 @@ class SelectionMixin(object):
|
||||
context = field.get_context(record)
|
||||
domain_cache_key = (freeze_value(domain), freeze_value(context))
|
||||
if domain_cache_key in self._domain_cache:
|
||||
self.selection = self._domain_cache[domain_cache_key]
|
||||
self.selection, self.help = (
|
||||
self._domain_cache[domain_cache_key])
|
||||
self._last_domain = (domain, context)
|
||||
if (domain, context) == self._last_domain:
|
||||
return
|
||||
@@ -88,7 +89,7 @@ class SelectionMixin(object):
|
||||
else:
|
||||
help_ = {}
|
||||
self._last_domain = (domain, context)
|
||||
self._domain_cache[domain_cache_key] = selection
|
||||
self._domain_cache[domain_cache_key] = (selection, help_)
|
||||
else:
|
||||
selection = []
|
||||
if self.nullable_widget:
|
||||
|
||||
Reference in New Issue
Block a user