diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index 79b1ae3918..8c4c49ab0d 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -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]; } } }