Do not re-select all records if current record is empty and selection is checked

This happens when the current record is removed when it is deleted.

Closes #13325
(grafted from 5e74c9cef4b5b04930e1c5da61c576070da1a1ca)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2024-06-10 17:23:18 +02:00
1 parent 67f2ae156f
commit 39d8ca7e1b
1 file changed
+7 -11
+7 -11
View File
@@ -564,7 +564,7 @@
var tbody = this.tbody;
var current_record = this.record;
if (jQuery.isEmptyObject(selected)) {
if (jQuery.isEmptyObject(selected) && current_record) {
selected = this.get_selected_paths();
if (this.selection.prop('checked') &&
!this.selection.prop('indeterminate')) {
@@ -574,16 +574,12 @@
selected.push([record.id]);
});
} else {
if (current_record) {
var current_path = current_record.get_path(this.group);
current_path = current_path.map(function(e) {
return e[1];
});
if (!Sao.common.contains(selected, current_path)) {
selected = [current_path];
}
} else if (!current_record) {
selected = [];
var current_path = current_record.get_path(this.group);
current_path = current_path.map(function(e) {
return e[1];
});
if (!Sao.common.contains(selected, current_path)) {
selected = [current_path];
}
}
}