mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 07:02:54 +00:00
set initial invoice period based on subscription start
This commit is contained in:
@@ -12,7 +12,7 @@ from frappe import _
|
|||||||
class Subscriptions(Document):
|
class Subscriptions(Document):
|
||||||
def before_insert(self):
|
def before_insert(self):
|
||||||
# update start just before the subscription doc is created
|
# 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):
|
def update_subscription_period(self, date=None):
|
||||||
self.set_current_invoice_start(date)
|
self.set_current_invoice_start(date)
|
||||||
@@ -95,6 +95,7 @@ class Subscriptions(Document):
|
|||||||
elif self.is_new_subscription():
|
elif self.is_new_subscription():
|
||||||
self.status = 'Active'
|
self.status = 'Active'
|
||||||
# todo: then generate new invoice
|
# todo: then generate new invoice
|
||||||
|
self.save()
|
||||||
|
|
||||||
def is_trialling(self):
|
def is_trialling(self):
|
||||||
return not self.period_has_passed(self.trial_period_end) and self.is_new_subscription()
|
return not self.period_has_passed(self.trial_period_end) and self.is_new_subscription()
|
||||||
|
|||||||
Reference in New Issue
Block a user