refactor: don't process future subscriptions

(cherry picked from commit 3a11577411)
This commit is contained in:
ruthra kumar
2024-08-13 12:34:10 +05:30
committed by Mergify
parent 582fffca93
commit 1f1e934675

View File

@@ -723,6 +723,12 @@ class Subscription(Document):
Process Subscription and create Invoices even if current date doesn't lie between current_invoice_start and currenct_invoice_end
It makes use of 'Proces Subscription' to force processing in a specific 'posting_date'
"""
# Don't process future subscriptions
if nowdate() < self.current_invoice_start:
frappe.msgprint(_("Subscription for Future dates cannot be processed."))
return
processing_date = None
if self.generate_invoice_at == "Beginning of the current subscription period":
processing_date = self.current_invoice_start