Se agregaron partidas y modelos

This commit is contained in:
2025-10-02 21:58:44 -06:00
parent 76909d0618
commit 466e12e623
30 changed files with 1090 additions and 8 deletions

View File

@@ -71,8 +71,39 @@ def auditar_acuse_coves(organizacion_id):
pass
@shared_task
def auditar_acuse_edocuments(organizacion_id):
# crear servicio individual para cada acuse de edocument faltante en microservicios
pass
pedimentos = obtener_pedimentos(organizacion_id)
for pedimento in pedimentos:
acuses_descargados = pedimento.documents.filter(document_type=4)
edocs = pedimento.documentos.all()
@shared_task
def crear_partidas(organizacion_id):
pedimentos = obtener_pedimentos(organizacion_id)
for pedimento in pedimentos:
crear_partidas_por_pedimento(pedimento.id)
@shared_task
def crear_partidas_por_pedimento(pedimento_id):
try:
pedimento = Pedimento.objects.get(id=pedimento_id)
except Pedimento.DoesNotExist:
return
if pedimento.numero_partidas > pedimento.partidas.count():
for i in range(1, pedimento.numero_partidas + 1):
from api.customs.models import Partida
Partida.objects.get_or_create(
pedimento=pedimento,
numero_partida=i,
organizacion_id=pedimento.organizacion_id
)