mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
b5f2c9d311
- List and create purchase orders - List and create purchase order line items
49 lines
942 B
Python
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',
|
|
]
|