fix(subscription): complete subscription if no outstanding invoices

This commit is contained in:
Jatin3128
2025-12-28 21:02:21 +05:30
parent 00c9e20df3
commit 20dc93a4b7

View File

@@ -223,7 +223,11 @@ class Subscription(Document):
"""
if self.is_trialling():
self.status = "Trialing"
elif self.status == "Active" and self.end_date and getdate(posting_date) > getdate(self.end_date):
elif (
not self.has_outstanding_invoice()
and self.end_date
and getdate(posting_date) > getdate(self.end_date)
):
self.status = "Completed"
elif self.is_past_grace_period():
self.status = self.get_status_for_past_grace_period()