details:   https://code.tryton.org/tryton/commit/c4c84d6300fc
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu May 21 17:54:51 2026 +0200
description:
        Reset the selection when cursor is set with reset view

        The view is reset when a new record is displayed and on editable list or
        list-form, we want to have only the current record selected even if the
        selection checkbox is checked for all records.

        Closes #14858
diffstat:

 sao/src/view/list_form.js |  6 ++++++
 sao/src/view/tree.js      |  7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r cce5dc4a8580 -r c4c84d6300fc sao/src/view/list_form.js
--- a/sao/src/view/list_form.js Sun Jun 07 14:17:41 2026 +0200
+++ b/sao/src/view/list_form.js Thu May 21 17:54:51 2026 +0200
@@ -115,6 +115,12 @@
             return this.group.slice();
         },
         set_cursor: function(new_, reset_view) {
+            if (!this.record) {
+                return;
+            }
+            if (reset_view) {
+                this.display([this.record.id]);
+            }
             if (new_) {
                 this.el.animate({
                     scrollTop: this.el[0].scrollHeight
diff -r cce5dc4a8580 -r c4c84d6300fc sao/src/view/tree.js
--- a/sao/src/view/tree.js      Sun Jun 07 14:17:41 2026 +0200
+++ b/sao/src/view/tree.js      Thu May 21 17:54:51 2026 +0200
@@ -1556,6 +1556,13 @@
                 this.display_size = this.group.length;
                 this.display();
             }
+            if (reset_view) {
+                let current_path = this.record.get_path(this.group);
+                current_path = current_path.map(function(e) {
+                    return e[1];
+                });
+                this.display([current_path]);
+            }
             if (path.length > 1) {
                 prm = this.rows[path[0]].expand_to_path(
                     path.slice(1),

Reply via email to