add API schema

This commit is contained in:
Matthias 2022-03-06 18:44:05 +01:00
parent 3452880d2a
commit de11b3463e
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 16 additions and 0 deletions

View File

@ -798,6 +798,13 @@ class SOAdditionalLineItemList(generics.ListCreateAPIView):
]
class SOAdditionalLineItemDetail(generics.RetrieveUpdateDestroyAPIView):
""" API endpoint for detail view of a SalesOrderAdditionalLineItem object """
queryset = models.SalesOrderAdditionalLineItem.objects.all()
serializer_class = serializers.SOAdditionalLineItemSerializer
class SOLineItemDetail(generics.RetrieveUpdateDestroyAPIView):
""" API endpoint for detail view of a SalesOrderLineItem object """
@ -1116,6 +1123,12 @@ order_api_urls = [
url(r'^$', SOLineItemList.as_view(), name='api-so-line-list'),
])),
# API endpoints for sales order additional line items
url(r'^so-additional-line/', include([
url(r'^(?P<pk>\d+)/$', SOAdditionalLineItemDetail.as_view(), name='api-so-additional-line-detail'),
url(r'^$', SOAdditionalLineItemList.as_view(), name='api-so-additional-line-list'),
])),
# API endpoints for sales order allocations
url(r'^so-allocation/', include([
url(r'^(?P<pk>\d+)/$', SOAllocationDetail.as_view(), name='api-so-allocation-detail'),

View File

@ -1175,6 +1175,9 @@ class SalesOrderAdditionalLineItem(OrderLineItem):
title: titile of line item
sale_price: The unit sale price for this OrderLineItem
"""
@staticmethod
def get_api_url():
return reverse('api-so-additional-line-list')
order = models.ForeignKey(SalesOrder, on_delete=models.CASCADE, related_name='additional_lines', verbose_name=_('Order'), help_text=_('Sales Order'))