update excel warehouse
This commit is contained in:
@@ -34,22 +34,27 @@ class QuotaDistributionExcelViewSet(viewsets.ModelViewSet):
|
||||
product = self.queryset
|
||||
query = request.query_params
|
||||
organization = get_organization_by_user(request.user)
|
||||
description_name = ''
|
||||
|
||||
if query.get('param') == 'assigned':
|
||||
product = product.filter(
|
||||
Q(assigned_organization=organization)
|
||||
).order_by('-modify_date')
|
||||
description_name='سهمیه'
|
||||
|
||||
elif query.get('param') == 'assigner':
|
||||
product = product.filter(
|
||||
Q(assigner_organization=organization)
|
||||
).order_by('-modify_date')
|
||||
description_name = 'توزیع'
|
||||
|
||||
elif query.get('param') == 'all':
|
||||
product = product.filter(
|
||||
Q(assigner_organization=organization) |
|
||||
Q(assigned_organization=organization)
|
||||
).order_by('-modify_date')
|
||||
description_name = ''
|
||||
|
||||
ser_data = distribution_serializers.QuotaDistributionSerializer(product, many=True).data
|
||||
|
||||
excel_options = [
|
||||
@@ -80,7 +85,7 @@ class QuotaDistributionExcelViewSet(viewsets.ModelViewSet):
|
||||
|
||||
create_header(worksheet, header_list, 5, 2, height=20, border_style='thin')
|
||||
|
||||
excel_description(worksheet, 'B1', f'سهمیه', row2='C3')
|
||||
excel_description(worksheet, 'B1', f'{description_name}', row2='C3')
|
||||
|
||||
create_header_freez(worksheet, excel_options, 1, 6, 7, height=22, width=20)
|
||||
|
||||
@@ -152,7 +157,7 @@ class QuotaDistributionExcelViewSet(viewsets.ModelViewSet):
|
||||
response = HttpResponse(
|
||||
content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
|
||||
response[
|
||||
'Content-Disposition'] = f'attachment; filename="اختلاف کشتار.xlsx"'.encode(
|
||||
'Content-Disposition'] = f'attachment; filename="سهمیه.xlsx"'.encode(
|
||||
'utf-8')
|
||||
response.write(output.getvalue())
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user