details:   https://code.tryton.org/tryton/commit/1439af7bdd4c
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Aug 21 10:04:05 2026 +0200
description:
        Cache the help with the selection per domain in selection mixin

        Closes #15031
diffstat:

 sao/src/common.js                 |  6 +++---
 tryton/tryton/common/selection.py |  5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 917de1b3e124 -r 1439af7bdd4c sao/src/common.js
--- a/sao/src/common.js Fri Aug 21 15:26:56 2026 +0200
+++ b/sao/src/common.js Fri Aug 21 10:04:05 2026 +0200
@@ -857,9 +857,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;
                 }
@@ -887,7 +887,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);
diff -r 917de1b3e124 -r 1439af7bdd4c tryton/tryton/common/selection.py
--- a/tryton/tryton/common/selection.py Fri Aug 21 15:26:56 2026 +0200
+++ b/tryton/tryton/common/selection.py Fri Aug 21 10:04:05 2026 +0200
@@ -65,7 +65,8 @@
             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 @@
                 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:

Reply via email to