Use saved tree state to restore selected record on form view

Closes #13822
(grafted from f8ca5d7c17c68f332f11bfafeee8d9222257a861)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2025-01-16 16:10:10 +01:00
parent 8ac0aef8bd
commit f6e2367dc3
@@ -852,11 +852,12 @@ class Screen:
parent = self.parent.id if self.parent else None
if parent is not None and parent < 0:
return
expanded_nodes, selected_nodes = [], []
state = self.tree_states[parent][view.children_field]
if state:
expanded_nodes, selected_nodes = state
else:
expanded_nodes, selected_nodes = [], []
if view.view_type in {'tree', 'list-form'}:
state = self.tree_states[parent][view.children_field]
if state:
expanded_nodes, selected_nodes = state
if (state is None
and CONFIG['client.save_tree_state']
and int(view.attributes.get('tree_state', False))):