add product
This commit is contained in:
1 parent
423d4cf40e
commit
c8d45dd07c
58 files changed
+8309
-674
No files matched your search
@@ -11,6 +11,7 @@ from rest_framework import generics
|
||||
from apps.customer.models import Customer as CustomerModel
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from utils import custom_permissions
|
||||
import pandas as pd
|
||||
from utils.tools import inline_serializer
|
||||
from io import BytesIO
|
||||
|
||||
@@ -212,13 +213,14 @@ class OrderRetrieveOperatorApi(APIView):
|
||||
|
||||
|
||||
class OrderRetrieveOperatorExcelApi(APIView):
|
||||
permission_classes = (IsAuthenticated, )
|
||||
permission_classes = (IsAuthenticated, custom_permissions.WorkspaceOperatorPermission)
|
||||
def get(self, request, order_id):
|
||||
|
||||
order_df = retrieve_order_item_excel(request=request, order_id=order_id)
|
||||
|
||||
excel_file = BytesIO()
|
||||
order_df.to_excel(excel_file, engine='xlsxwriter', index=False)
|
||||
with pd.ExcelWriter(excel_file, engine='xlsxwriter', engine_kwargs={'options': {'strings_to_formulas': False, 'strings_to_urls': False}}) as writer:
|
||||
order_df.to_excel(writer, index=False)
|
||||
excel_file.seek(0)
|
||||
|
||||
response = HttpResponse(excel_file.read(), content_type='application/ms-excel')
|
||||
|
||||
Reference in new issue
Block a user