From 61ac02a045b9b5dc5e246d2209052ce5c3aa6724 Mon Sep 17 00:00:00 2001 From: luwol03 Date: Mon, 25 Jul 2022 03:23:20 +0200 Subject: [PATCH] Fix LabelPrintingMixin label_instance contains now specific data (#3394) --- InvenTree/label/api.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/InvenTree/label/api.py b/InvenTree/label/api.py index 7b533c8825..68c4205178 100644 --- a/InvenTree/label/api.py +++ b/InvenTree/label/api.py @@ -95,6 +95,7 @@ class LabelPrintMixin: label_name = "label.pdf" label_names = [] + label_instances = [] # Merge one or more PDF files into a single download for item in items_to_print: @@ -104,6 +105,7 @@ class LabelPrintMixin: label_name = label.generate_filename(request) label_names.append(label_name) + label_instances.append(label) if debug_mode: outputs.append(label.render_as_string(request)) @@ -123,9 +125,6 @@ class LabelPrintMixin: - Return a JSON response indicating that the printing has been offloaded """ - # Label instance - label_instance = self.get_object() - for idx, output in enumerate(outputs): """For each output, we generate a temporary image file, which will then get sent to the printer.""" @@ -138,7 +137,7 @@ class LabelPrintMixin: plugin.plugin_slug(), pdf, filename=label_names[idx], - label_instance=label_instance, + label_instance=label_instances[idx], user=request.user, )