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
(grafted from 5719977cd18ed02fc485a0bc8be4abc6b4aec6b3)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2025-03-26 20:07:54 +01:00
parent 63c5db6aa2
commit fdd00582b6
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -2275,7 +2275,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) {
@@ -879,7 +879,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)