diff --git a/breathecode/payments/tasks.py b/breathecode/payments/tasks.py index e3bf7491e..8bf13ac83 100644 --- a/breathecode/payments/tasks.py +++ b/breathecode/payments/tasks.py @@ -606,8 +606,10 @@ def alert_payment_issue(message: str, button: str) -> None: plan_financing.next_payment_at += delta plan_financing.save() - bag.was_delivered = True - bag.save() + # if this charge but the client paid all its installments, there hasn't been a new bag created + if bag: + bag.was_delivered = True + bag.save() renew_plan_financing_consumables.delay(plan_financing.id)