From 9fd88aa7e03e8962a23fb9b1d5c2c123ff1dfa0d Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Thu, 23 Mar 2023 13:57:10 +0100 Subject: [PATCH] [FIX] *_auditfile_export: handle corner case for single threaded servers --- .../models/xaf_auditfile_export.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py b/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py index 9da3ceaad..d44887310 100644 --- a/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py +++ b/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py @@ -203,6 +203,13 @@ def _get_auditfile_template(self): def button_generate(self): """Generate, store and validate auditfile.""" + # First check wether file is already there. Should not be possible, because of + # the locking, but there is a corner case for single threaded servers, where + # this button can be pressed after another sessions has already started the + # generation. Then this method will only run after the first job released the + # lock and finished processing. + if self.auditfile: + raise exceptions.UserError(_("Auditfile has already been generated.")) tmpdir = mkdtemp() self._acquire_in_use() try: