diff --git a/sao/src/tab.js b/sao/src/tab.js index 8878f84eb5..11feb64320 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -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') { diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index cd62fbaa4c..7a81dc87a0 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -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':