Merge pull request #1041 from eeintech/api_default_location

Added part 'default_location' to serializer
This commit is contained in:
Oliver 2020-10-18 22:01:35 +11:00 committed by GitHub
commit 83077514cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,30 +2,20 @@
JSON serializers for Part app JSON serializers for Part app
""" """
import imghdr import imghdr
from rest_framework import serializers
from .models import Part, PartStar
from .models import PartCategory
from .models import BomItem
from .models import PartParameter, PartParameterTemplate
from .models import PartAttachment
from .models import PartTestTemplate
from .models import PartSellPriceBreak
from stock.models import StockItem
from decimal import Decimal from decimal import Decimal
from sql_util.utils import SubquerySum, SubqueryCount
from django.db.models import Q from django.db.models import Q
from django.db.models.functions import Coalesce from django.db.models.functions import Coalesce
from InvenTree.serializers import (InvenTreeAttachmentSerializerField,
InvenTreeModelSerializer)
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus
from rest_framework import serializers
from sql_util.utils import SubqueryCount, SubquerySum
from stock.models import StockItem
from InvenTree.status_codes import PurchaseOrderStatus, BuildStatus from .models import (BomItem, Part, PartAttachment, PartCategory,
from InvenTree.serializers import InvenTreeModelSerializer PartParameter, PartParameterTemplate, PartSellPriceBreak,
from InvenTree.serializers import InvenTreeAttachmentSerializerField PartStar, PartTestTemplate)
class CategorySerializer(InvenTreeModelSerializer): class CategorySerializer(InvenTreeModelSerializer):
@ -41,6 +31,7 @@ class CategorySerializer(InvenTreeModelSerializer):
'pk', 'pk',
'name', 'name',
'description', 'description',
'default_location',
'pathstring', 'pathstring',
'url', 'url',
'parent', 'parent',
@ -304,6 +295,7 @@ class PartSerializer(InvenTreeModelSerializer):
'category_detail', 'category_detail',
'component', 'component',
'description', 'description',
'default_location',
'full_name', 'full_name',
'image', 'image',
'in_stock', 'in_stock',