Fix for label printing plugins (#5371)

- Don't pass pdf_file data to background process
- pre-rendered template data cannot be pickled
This commit is contained in:
Oliver 2023-07-31 10:07:12 +10:00 committed by GitHub
parent b89a120f9e
commit 36d669d70d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,6 +116,8 @@ class LabelPrintingMixin:
self.print_label(**print_args)
else:
# Non-blocking print job
# Offload the print job to a background worker
self.offload_label(**print_args)
# Return a JSON response to the user
@ -151,6 +153,9 @@ class LabelPrintingMixin:
Offloads a call to the 'print_label' method (of this plugin) to a background worker.
"""
# Exclude the 'pdf_file' object - cannot be pickled
kwargs.pop('pdf_file', None)
offload_task(
plugin_label.print_label,
self.plugin_slug(),