diff --git a/InvenTree/order/api.py b/InvenTree/order/api.py index 247e391767..1012fba392 100644 --- a/InvenTree/order/api.py +++ b/InvenTree/order/api.py @@ -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\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\d+)/$', SOAllocationDetail.as_view(), name='api-so-allocation-detail'), diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index 4a1147c890..2a975a432c 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -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'))