update test case, fix bugs
diff --git a/erpnext/accounts/doctype/subscriptions/subscriptions.py b/erpnext/accounts/doctype/subscriptions/subscriptions.py
index cd43a9c..a56a2f7 100644
--- a/erpnext/accounts/doctype/subscriptions/subscriptions.py
+++ b/erpnext/accounts/doctype/subscriptions/subscriptions.py
@@ -155,8 +155,7 @@
def generate_invoice(self):
invoice = self.create_invoice()
self.append('invoices', {'invoice': invoice.name})
- self.save() # Validates all over again but we don't mind
- self.subscription_updated(invoice)
+ self.save()
return invoice
@@ -174,9 +173,9 @@
invoice.append('items', item)
# Taxes
- # todo: tax template does not populate tax table
if self.tax_template:
invoice.taxes_and_charges = self.tax_template
+ invoice.set_taxes()
# Due date
invoice.append(
@@ -215,9 +214,6 @@
)
return item_names
- def subscription_updated(self, invoice):
- self.update_subscription_period()
-
def process(self):
"""
To be called by task periodically. It checks the subscription and takes appropriate action
diff --git a/erpnext/accounts/doctype/subscriptions/test_subscriptions.py b/erpnext/accounts/doctype/subscriptions/test_subscriptions.py
index a0f9400..d02b4c8 100644
--- a/erpnext/accounts/doctype/subscriptions/test_subscriptions.py
+++ b/erpnext/accounts/doctype/subscriptions/test_subscriptions.py
@@ -119,7 +119,7 @@
subscription.process()
self.assertEqual(len(subscription.invoices), 1)
- self.assertEqual(subscription.current_invoice_start, nowdate())
+ self.assertEqual(subscription.current_invoice_start, '2018-01-01')
self.assertEqual(subscription.status, 'Past Due Date')
subscription.delete()