From 5121857994a116de8d61b510dca022c19f4369e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Bernardi?= Date: Tue, 12 Oct 2021 18:31:21 -0300 Subject: [PATCH] lims: results report: avoid error when no record is selected to print --- lims/results_report.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lims/results_report.py b/lims/results_report.py index a83039c4..a0fd1a3a 100644 --- a/lims/results_report.py +++ b/lims/results_report.py @@ -2823,7 +2823,9 @@ class PrintResultReport(Wizard): print_ = StateReport('lims.result_report') def transition_start(self): - return 'print_' + if Transaction().context['active_ids']: + return 'print_' + return 'end' def do_print_(self, action): data = {} @@ -3864,6 +3866,10 @@ class PrintGlobalResultReport(Wizard): def transition_start(self): ResultsReport = Pool().get('lims.results_report') + + if not Transaction().context['active_ids']: + return 'end' + for active_id in Transaction().context['active_ids']: results_report = ResultsReport(active_id)