Skip to content

Commit

Permalink
Fix LabelPrintingMixin label_instance contains now specific data (#3394)
Browse files Browse the repository at this point in the history
  • Loading branch information
luwol03 authored Jul 25, 2022
1 parent eecb266 commit 61ac02a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions InvenTree/label/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def print(self, request, items_to_print):
label_name = "label.pdf"

label_names = []
label_instances = []

# Merge one or more PDF files into a single download
for item in items_to_print:
Expand All @@ -104,6 +105,7 @@ def print(self, request, items_to_print):
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))
Expand All @@ -123,9 +125,6 @@ def print(self, request, items_to_print):
- 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."""

Expand All @@ -138,7 +137,7 @@ def print(self, request, items_to_print):
plugin.plugin_slug(),
pdf,
filename=label_names[idx],
label_instance=label_instance,
label_instance=label_instances[idx],
user=request.user,
)

Expand Down

0 comments on commit 61ac02a

Please sign in to comment.