Do not set current record to the first id if the list is empty

Closes #13130
(grafted from 61da30b168e7a11392ac235bea43460bbb998873)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-03-26 11:20:07 +01:00
1 parent c537c25fe1
commit d771ed9402
2 files changed
+6 -3

No files matched your search

+4 -2
View File
@@ -506,8 +506,10 @@
attributes.res_id = [attributes.res_id];
}
screen.load(attributes.res_id);
screen.current_record = screen.group.get(
attributes.res_id[0]);
if (attributes.res_id.length) {
screen.current_record = screen.group.get(
attributes.res_id[0]);
}
screen.display();
} else {
if (screen.current_view.view_type == 'form') {
+2 -1
View File
@@ -66,7 +66,8 @@ class Form(TabContent):
if isinstance(res_id, int):
res_id = [res_id]
self.screen.load(res_id)
self.screen.current_record = self.screen.group.get(res_id[0])
if res_id:
self.screen.current_record = self.screen.group.get(res_id[0])
self.screen.display()
else:
if self.screen.current_view.view_type == 'form':