mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for scanning invalid barcode (#4597)
- Cast PK to integer first, so we get a value error thrown - Prevents other errors (such as TypeError) from throwing
This commit is contained in:
parent
46cd109359
commit
f70bde02d2
@ -100,7 +100,8 @@ class InvenTreeInternalBarcodePlugin(BarcodeMixin, InvenTreePlugin):
|
|||||||
|
|
||||||
if label in barcode_dict:
|
if label in barcode_dict:
|
||||||
try:
|
try:
|
||||||
instance = model.objects.get(pk=barcode_dict[label])
|
pk = int(barcode_dict[label])
|
||||||
|
instance = model.objects.get(pk=pk)
|
||||||
return self.format_matched_response(label, model, instance)
|
return self.format_matched_response(label, model, instance)
|
||||||
except (ValueError, model.DoesNotExist):
|
except (ValueError, model.DoesNotExist):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user