distribution organizations info - upload document inventory
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from apps.warehouse.web.api.v1 import serializers as warehouse_serializers
|
||||
from apps.warehouse import models as warehouse_models
|
||||
from common.liara_tools import upload_to_liara
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import viewsets, filters
|
||||
@@ -13,6 +14,25 @@ class InventoryEntryViewSet(viewsets.ModelViewSet):
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = ['']
|
||||
|
||||
@action(
|
||||
methods=['get'],
|
||||
detail=True,
|
||||
url_path='confirmation_document',
|
||||
url_name='confirmation_document',
|
||||
name='confirmation_document'
|
||||
)
|
||||
def confirmation_document(self, request, pk=None):
|
||||
""" upload document for inventory entry confirmation """
|
||||
|
||||
inventory = self.get_object()
|
||||
|
||||
# upload document to liara
|
||||
document = request.FILES.get('document')
|
||||
document_url = upload_to_liara(
|
||||
document,
|
||||
f'inventory_entry_document_{inventory.di}'
|
||||
)
|
||||
|
||||
|
||||
class InventoryQuotaSaleTransactionViewSet(viewsets.ModelViewSet):
|
||||
queryset = warehouse_models.InventoryQuotaSaleTransaction.objects.all()
|
||||
|
||||
Reference in New Issue
Block a user