From bcb8fd1cd21fe9cbe01c6327e79b42834fd2dc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 16 Jun 2025 11:38:20 +0200 Subject: [PATCH] Do not execute button if there is no current record for the screen --- sao/src/screen.js | 4 ++++ tryton/tryton/gui/window/view_form/screen/screen.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sao/src/screen.js b/sao/src/screen.js index 3f8466bbdf..beecf7a3fb 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -2041,6 +2041,10 @@ } }; + if (!this.current_record) { + return; + } + if (this.current_view) { var selected_records = this.current_view.selected_records; this.current_view.set_value(); diff --git a/tryton/tryton/gui/window/view_form/screen/screen.py b/tryton/tryton/gui/window/view_form/screen/screen.py index 77abfd4101..52128bfebc 100644 --- a/tryton/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/tryton/gui/window/view_form/screen/screen.py @@ -1257,6 +1257,9 @@ class Screen: def button(self, button): 'Execute button on the selected records' + if not self.current_record: + return + if self.current_view: self.current_view.set_value() fields = self.current_view.get_fields()