fix(label): Check if attributes exist

This commit is contained in:
Andreas Mieke 2024-04-20 22:06:09 -04:00
parent fdea2b70d1
commit 8572cccf9f
Signed by: zenermerps
SSH key fingerprint: SHA256:Ne+hwc5QIgYlqCuLZ0LV3301Wo/p8UoGOrGC+T6S0t8

View file

@ -65,9 +65,9 @@ class PhomemoLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
'name': tpart.name,
'description': tpart.description,
'pk': tpart.pk,
'params': tpart.parameters_map(),
'category': tpart.category.name,
'category_path': tpart.category.pathstring,
'params': tpart.parameters_map() if hasattr(tpart, 'parameters_map') else None,
'category': tpart.category.name if hasattr(tpart, 'category') else None,
'category_path': tpart.category.pathstring if hasattr(tpart, 'category') else None,
'barcode': barcode,
'type': kwargs['label_instance'].SUBDIR
}