Change current record for the first selected only if there is no current record

#4028 added the behavior to apply the selected record also on form view the
first time.
But when switching to a calendar view from a form view, the tree states is
stored with the current record. If the calendar view is cleared (always with
sao via the search_filter), then the tree_states_done is cleared and on the
second switch to the form view the current record is override by record stored
in the tree states (from the first form switch).

Closes #13939
This commit is contained in:
Cédric Krier committed 2025-03-26 20:07:54 +01:00
1 parent cd5a54cb2f
commit 7a9820e5af
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -2312,7 +2312,8 @@
return view.display(selected_nodes);
} else {
var record;
if (!jQuery.isEmptyObject(selected_nodes)) {
if (!jQuery.isEmptyObject(selected_nodes) &&
!this.current_record) {
for (const id of selected_nodes[0]) {
const new_record = this.group.get(id);
if (!new_record) {
@@ -910,7 +910,7 @@ class Screen:
view.expand_nodes(expanded_nodes)
view.select_nodes(selected_nodes)
else:
if selected_nodes:
if selected_nodes and not self.current_record:
record = None
for node in selected_nodes[0]:
new_record = self.group.get(node)