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 c1106ce25..1755d22fd 100644 --- a/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py +++ b/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py @@ -208,6 +208,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: