mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-10 06:37:17 +00:00
(cherry picked from commit 4a0e28510f)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
co-authored by
Oliver
parent
b1b060915e
commit
4e0be4a65a
@@ -32,10 +32,24 @@ def print_reports(
|
|||||||
try:
|
try:
|
||||||
template = ReportTemplate.objects.get(pk=template_id)
|
template = ReportTemplate.objects.get(pk=template_id)
|
||||||
output = DataOutput.objects.get(pk=output_id)
|
output = DataOutput.objects.get(pk=output_id)
|
||||||
|
except DataOutput.DoesNotExist:
|
||||||
|
# The DataOutput may have already been consumed and deleted by the time
|
||||||
|
# this task runs (e.g. if the background worker redelivered the task)
|
||||||
|
logger.info(
|
||||||
|
'DataOutput %s no longer exists - skipping print_reports task', output_id
|
||||||
|
)
|
||||||
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
log_error('report.tasks.print_reports')
|
log_error('report.tasks.print_reports')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if output.complete:
|
||||||
|
# This task has already been processed (e.g. a redelivered/duplicate task) - skip it
|
||||||
|
logger.info(
|
||||||
|
'DataOutput %s is already complete - skipping print_reports task', output_id
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# Fetch user information
|
# Fetch user information
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
@@ -86,10 +100,24 @@ def print_labels(
|
|||||||
try:
|
try:
|
||||||
template = LabelTemplate.objects.get(pk=template_id)
|
template = LabelTemplate.objects.get(pk=template_id)
|
||||||
output = DataOutput.objects.get(pk=output_id)
|
output = DataOutput.objects.get(pk=output_id)
|
||||||
|
except DataOutput.DoesNotExist:
|
||||||
|
# The DataOutput may have already been consumed and deleted by the time
|
||||||
|
# this task runs (e.g. if the background worker redelivered the task)
|
||||||
|
logger.info(
|
||||||
|
'DataOutput %s no longer exists - skipping print_labels task', output_id
|
||||||
|
)
|
||||||
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
log_error('report.tasks.print_labels')
|
log_error('report.tasks.print_labels')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if output.complete:
|
||||||
|
# This task has already been processed (e.g. a redelivered/duplicate task) - skip it
|
||||||
|
logger.info(
|
||||||
|
'DataOutput %s is already complete - skipping print_labels task', output_id
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# Fetch user information
|
# Fetch user information
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user