Skip to content

Commit

Permalink
do finetuning on rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Dec 12, 2024
1 parent a7dd61c commit 8b138f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions inventree_zebra/zebra_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ def print_label(self, **kwargs):
template_file = os.path.join(template_file, str(kwargs['context']['template']))

# Render the template
fields = {'object': kwargs['item_instance']}
raw_zpl = str(render(None, template_file, fields).content)
fields = {'object': kwargs['item_instance'], 'context': kwargs['context']}
try:
raw_zpl = str(render(None, template_file, fields).content, 'utf-8').replace('\n', '')
except Exception:
raise Exception('Error rendering ZPL template')

# Create the zpl data
li = zpl.Label(height, width, dpmm)
Expand Down

0 comments on commit 8b138f4

Please sign in to comment.