fix: Invoice generation for Unpaid subscriptions

This commit is contained in:
Deepesh Garg
2020-11-19 19:39:08 +05:30
parent fac940042b
commit 224006aebd

View File

@@ -408,6 +408,15 @@ class Subscription(Document):
else:
self.set_status_grace_period()
if getdate() > getdate(self.current_invoice_end):
self.update_subscription_period(add_days(self.current_invoice_end, 1))
# Generate invoices periodically even if current invoice are unpaid
if not self.is_current_invoice_generated() and (self.is_postpaid_to_invoice()
or self.is_prepaid_to_invoice()):
prorate = frappe.db.get_single_value('Subscription Settings', 'prorate')
self.generate_invoice(prorate)
@staticmethod
def is_not_outstanding(invoice):
"""