diff --git a/api/customs/tasks/auditoria.py b/api/customs/tasks/auditoria.py index 50ce843..0ba713f 100644 --- a/api/customs/tasks/auditoria.py +++ b/api/customs/tasks/auditoria.py @@ -90,7 +90,14 @@ def crear_partidas(organizacion_id): for pedimento in pedimentos: - crear_partidas_por_pedimento(pedimento.id) + 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=organizacion_id + ) @shared_task def crear_partidas_por_pedimento(pedimento_id):