mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
PEP fixes
This commit is contained in:
parent
509d58979e
commit
c6dc196053
@ -27,7 +27,6 @@ from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
|
|||||||
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
|
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
|
||||||
from stock.models import StockItem
|
from stock.models import StockItem
|
||||||
|
|
||||||
from .admin import BomItemResource
|
|
||||||
from .models import (BomItem, BomItemSubstitute,
|
from .models import (BomItem, BomItemSubstitute,
|
||||||
Part, PartAttachment, PartCategory, PartRelated,
|
Part, PartAttachment, PartCategory, PartRelated,
|
||||||
PartParameter, PartParameterTemplate, PartSellPriceBreak,
|
PartParameter, PartParameterTemplate, PartSellPriceBreak,
|
||||||
@ -470,7 +469,7 @@ class BomItemSerializer(InvenTreeModelSerializer):
|
|||||||
def validate_quantity(self, quantity):
|
def validate_quantity(self, quantity):
|
||||||
if quantity <= 0:
|
if quantity <= 0:
|
||||||
raise serializers.ValidationError(_("Quantity must be greater than zero"))
|
raise serializers.ValidationError(_("Quantity must be greater than zero"))
|
||||||
|
|
||||||
return quantity
|
return quantity
|
||||||
|
|
||||||
part = serializers.PrimaryKeyRelatedField(queryset=Part.objects.filter(assembly=True))
|
part = serializers.PrimaryKeyRelatedField(queryset=Part.objects.filter(assembly=True))
|
||||||
@ -955,7 +954,7 @@ class BomExtractSerializer(serializers.Serializer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
|
||||||
data = self.validated_data
|
data = self.validated_data
|
||||||
|
|
||||||
master_part = data['part']
|
master_part = data['part']
|
||||||
@ -978,7 +977,6 @@ class BomUploadSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
|
|
||||||
|
|
||||||
items = data['items']
|
items = data['items']
|
||||||
|
|
||||||
if len(items) == 0:
|
if len(items) == 0:
|
||||||
@ -1008,6 +1006,6 @@ class BomUploadSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
# Create a new BomItem object
|
# Create a new BomItem object
|
||||||
BomItem.objects.create(**item)
|
BomItem.objects.create(**item)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise serializers.ValidationError(detail=serializers.as_serializer_error(e))
|
raise serializers.ValidationError(detail=serializers.as_serializer_error(e))
|
||||||
|
@ -28,20 +28,17 @@ import requests
|
|||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
|
|
||||||
from rapidfuzz import fuzz
|
from decimal import Decimal
|
||||||
from decimal import Decimal, InvalidOperation
|
|
||||||
|
|
||||||
from .models import PartCategory, Part
|
from .models import PartCategory, Part
|
||||||
from .models import PartParameterTemplate
|
from .models import PartParameterTemplate
|
||||||
from .models import PartCategoryParameterTemplate
|
from .models import PartCategoryParameterTemplate
|
||||||
from .models import BomItem
|
|
||||||
from .models import PartSellPriceBreak, PartInternalPriceBreak
|
from .models import PartSellPriceBreak, PartInternalPriceBreak
|
||||||
|
|
||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
from company.models import SupplierPart
|
from company.models import SupplierPart
|
||||||
from common.files import FileManager
|
from common.files import FileManager
|
||||||
from common.views import FileManagementFormView, FileManagementAjaxView
|
from common.views import FileManagementFormView, FileManagementAjaxView
|
||||||
from common.forms import UploadFileForm, MatchFieldForm
|
|
||||||
|
|
||||||
from stock.models import StockItem, StockLocation
|
from stock.models import StockItem, StockLocation
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user