feat(label): Add location

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

View file

@ -50,7 +50,7 @@ class PhomemoLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
case 'stockitem':
tpart = object_to_print.part
barcode = '2' + str(object_to_print.pk)
case 'location':
case 'stocklocation':
tpart = object_to_print
barcode = '3' + str(object_to_print.pk)
case 'build':
@ -68,6 +68,8 @@ class PhomemoLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
'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,
'location': tpart.location.name if hasattr(tpart, 'location') else None,
'location_path': tpart.location.pathstring if hasattr(tpart, 'location') else None,
'barcode': barcode,
'type': kwargs['label_instance'].SUBDIR
}