From 2a11c18383b4e92427cc8be8f11227a030645a23 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Thu, 1 Mar 2018 08:47:38 +0100 Subject: [PATCH] set initial invoice period based on subscription start --- 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 a56a2f7467..7a4886bafe 100644 --- a/erpnext/accounts/doctype/subscriptions/subscriptions.py +++ b/erpnext/accounts/doctype/subscriptions/subscriptions.py @@ -12,7 +12,7 @@ from frappe import _ class Subscriptions(Document): def before_insert(self): # update start just before the subscription doc is created - self.update_subscription_period() + self.update_subscription_period(self.start) def update_subscription_period(self, date=None): self.set_current_invoice_start(date) @@ -95,6 +95,7 @@ class Subscriptions(Document): elif self.is_new_subscription(): self.status = 'Active' # todo: then generate new invoice + self.save() def is_trialling(self): return not self.period_has_passed(self.trial_period_end) and self.is_new_subscription()