InvenTree/InvenTree/order/serializers.py
Oliver Walters b5f2c9d311 Add API endpoint for purchase orders
- List and create purchase orders
- List and create purchase order line items
2019-08-02 21:46:26 +10:00

49 lines
942 B
Python

"""
JSON serializers for the Order API
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from InvenTree.serializers import InvenTreeModelSerializer
from .models import PurchaseOrder, PurchaseOrderLineItem
class POSerializer(InvenTreeModelSerializer):
""" Serializes an Order object """
class Meta:
model = PurchaseOrder
fields = [
'pk',
'supplier',
'reference',
'description',
'URL',
'status',
'notes',
]
read_only_fields = [
'reference',
'status'
]
class POLineItemSerializer(InvenTreeModelSerializer):
class Meta:
model = PurchaseOrderLineItem
fields = [
'pk',
'quantity',
'reference',
'notes',
'order',
'part',
'received',
]