Compare commits

...

6 Commits

View File

@@ -1919,19 +1919,14 @@ class PedimentoDocumentViewSet(viewsets.ModelViewSet, DocumentosFiltradosMixin):
TIPOS_PERMITIDOS = ['2', '3'] # <-- Ajusta aquí tus tipos TIPOS_PERMITIDOS = ['2', '3'] # <-- Ajusta aquí tus tipos
tipo_documento = self.request.query_params.get('document_type') tipo_documento = self.request.query_params.get('document_type')
if tipo_documento: if tipo_documento:
if tipo_documento == '2': queryset = queryset.filter(document_type_id__in=TIPOS_PERMITIDOS)
queryset = queryset.filter(archivo__startswith=f'documents/vu_PC_{pedimento.pedimento_app}.xml')
elif tipo_documento == '3':
queryset = queryset.filter(archivo__startswith=f'documents/vu_RM_{pedimento.pedimento_app}.xml')
else:
queryset = queryset.filter(archivo__startswith=f'documents/NOTFOUND_{pedimento.pedimento_app}.xml')
else: else:
# Filtrar por tipos permitidos # Filtrar por tipos permitidos
# queryset = queryset.filter(document_type_id__in=TIPOS_PERMITIDOS) # queryset = queryset.filter(document_type_id__in=TIPOS_PERMITIDOS)
queryset = queryset.filter( queryset = queryset.filter(
Q(archivo__startswith=f'documents/vu_PC_{pedimento.pedimento_app}.xml') | Q(archivo__istartswith=f'documents/vu_PC_')
Q(archivo__startswith=f'documents/vu_RM_{pedimento.pedimento_app}.xml') # Q(archivo__startswith=f'documents/vu_RM_')
) )
buscar_archivo = self.request.query_params.get('archivo__icontains') buscar_archivo = self.request.query_params.get('archivo__icontains')
@@ -1948,6 +1943,7 @@ class PedimentoDocumentViewSet(viewsets.ModelViewSet, DocumentosFiltradosMixin):
queryset = queryset.filter(pedimento__pedimento_app=pedimento_numero) queryset = queryset.filter(pedimento__pedimento_app=pedimento_numero)
return queryset return queryset
class TriggerPedimentoCompletoView(APIView): class TriggerPedimentoCompletoView(APIView):
""" """
Endpoint interno para disparar la descarga de pedimento completo Endpoint interno para disparar la descarga de pedimento completo