2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-12 06:40:53 +00:00

Add unit testing framework for barcodes

This commit is contained in:
Oliver Walters
2020-06-11 14:44:56 +10:00
parent 22a8e82108
commit 0559946791
5 changed files with 139 additions and 35 deletions

@@ -50,6 +50,18 @@ class BarcodePlugin:
return None
def getStockItemByHash(self):
"""
Attempt to retrieve a StockItem associated with this barcode,
based on the barcode hash.
"""
try:
item = StockItem.objects.get(uid=self.hash())
return item
except StockItem.DoesNotExist:
return None
def renderStockItem(self, item):
"""
Render a stock item to JSON response