Update subscription.py

This commit is contained in:
Himanshu 2021-10-09 09:37:54 +01:00 committed by GitHub
parent 951ab9f78f
commit 44306bd0e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -559,15 +559,13 @@ class Subscription(Document):
else:
self.set_status_grace_period()
update_subscription = True if getdate() > getdate(self.current_invoice_end) else False
# Generate invoices periodically even if current invoice are unpaid
if self.generate_new_invoices_past_due_date and 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)
if update_subscription:
if getdate() > getdate(self.current_invoice_end):
self.update_subscription_period(add_days(self.current_invoice_end, 1))
@staticmethod