mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Flake fixes
This commit is contained in:
parent
07be08d0f3
commit
beccbe8583
@ -1,7 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import hashlib
|
||||
|
||||
from django.urls import reverse
|
||||
from django.conf.urls import url
|
||||
from django.utils.translation import ugettext as _
|
||||
@ -11,13 +9,10 @@ from rest_framework import permissions
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
import InvenTree.plugins as InvenTreePlugins
|
||||
|
||||
from stock.models import StockItem
|
||||
from stock.serializers import StockItemSerializer
|
||||
|
||||
import barcode.plugins as BarcodePlugins
|
||||
from barcode.barcode import BarcodePlugin, load_barcode_plugins, hash_barcode
|
||||
from barcode.barcode import load_barcode_plugins, hash_barcode
|
||||
|
||||
|
||||
class BarcodeScan(APIView):
|
||||
@ -233,7 +228,6 @@ class BarcodeAssign(APIView):
|
||||
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
||||
response['stockitem'] = serializer.data
|
||||
|
||||
|
||||
return Response(response)
|
||||
|
||||
|
||||
@ -243,4 +237,4 @@ barcode_api_urls = [
|
||||
|
||||
# Catch-all performs barcode 'scan'
|
||||
url(r'^.*$', BarcodeScan.as_view(), name='api-barcode-scan'),
|
||||
]
|
||||
]
|
||||
|
@ -1,11 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
from InvenTree import plugins as InvenTreePlugins
|
||||
from barcode import plugins as BarcodePlugins
|
||||
|
||||
from stock.models import StockItem
|
||||
from stock.serializers import StockItemSerializer, LocationSerializer
|
||||
from part.serializers import PartSerializer
|
||||
|
||||
@ -70,7 +70,6 @@ class BarcodePlugin:
|
||||
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
||||
return serializer.data
|
||||
|
||||
|
||||
def getStockLocation(self):
|
||||
"""
|
||||
Attempt to retrieve a StockLocation associated with this barcode.
|
||||
@ -93,7 +92,7 @@ class BarcodePlugin:
|
||||
Default implementation returns None
|
||||
"""
|
||||
|
||||
return None
|
||||
return None
|
||||
|
||||
def renderPart(self, part):
|
||||
"""
|
||||
@ -145,4 +144,4 @@ def load_barcode_plugins(debug=False):
|
||||
else:
|
||||
print("No barcode plugins found")
|
||||
|
||||
return plugins
|
||||
return plugins
|
||||
|
@ -16,4 +16,4 @@ class DigikeyBarcodePlugin(BarcodePlugin):
|
||||
TODO: Validation of Digikey barcodes.
|
||||
"""
|
||||
|
||||
return False
|
||||
return False
|
||||
|
@ -84,7 +84,7 @@ class BarcodeAPITest(APITestCase):
|
||||
|
||||
response = self.client.post(
|
||||
self.assign_url, format='json',
|
||||
data = {
|
||||
data={
|
||||
'barcode': barcode_data,
|
||||
'stockitem': item.pk
|
||||
}
|
||||
@ -106,7 +106,7 @@ class BarcodeAPITest(APITestCase):
|
||||
# Ensure that the same UID cannot be assigned to a different stock item!
|
||||
response = self.client.post(
|
||||
self.assign_url, format='json',
|
||||
data = {
|
||||
data={
|
||||
'barcode': barcode_data,
|
||||
'stockitem': 521
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ def get_plugins(pkg, baseclass):
|
||||
return plugins
|
||||
|
||||
|
||||
|
||||
def load_action_plugins():
|
||||
"""
|
||||
Return a list of all registered action plugins
|
||||
|
Loading…
Reference in New Issue
Block a user