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:
Cédric Krier
2026-08-21 10:04:05 +02:00
parent 2186c3740c
commit 6ff68e42b9
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -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);
+3 -2
View File
@@ -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: