From 9bf029a16e836a97523ac475c88d3666aa5aaf7c Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Tue, 27 Feb 2018 15:19:02 +0100 Subject: [PATCH] generate new invoice only when `current_invoice_end` is past --- erpnext/accounts/doctype/subscriptions/subscriptions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/subscriptions/subscriptions.py b/erpnext/accounts/doctype/subscriptions/subscriptions.py index 0cccaebf1b..3866981a8a 100644 --- a/erpnext/accounts/doctype/subscriptions/subscriptions.py +++ b/erpnext/accounts/doctype/subscriptions/subscriptions.py @@ -141,7 +141,8 @@ class Subscriptions(Document): frappe.throw(_('Both Trial Period Start Date and Trial Period End Date must be set')) def after_insert(self): - if not self.is_trialling(): + # todo: deal with users who collect prepayments. Maybe a new Subscription Invoice doctype? + if not self.is_trialling() and nowdate() > self.current_invoice_end: self.generate_invoice() def generate_invoice(self):