update test case, fix bugs
This commit is contained in:
parent
8f37926ca8
commit
d9fec69a70
@ -155,8 +155,7 @@ class Subscriptions(Document):
|
|||||||
def generate_invoice(self):
|
def generate_invoice(self):
|
||||||
invoice = self.create_invoice()
|
invoice = self.create_invoice()
|
||||||
self.append('invoices', {'invoice': invoice.name})
|
self.append('invoices', {'invoice': invoice.name})
|
||||||
self.save() # Validates all over again but we don't mind
|
self.save()
|
||||||
self.subscription_updated(invoice)
|
|
||||||
|
|
||||||
return invoice
|
return invoice
|
||||||
|
|
||||||
@ -174,9 +173,9 @@ class Subscriptions(Document):
|
|||||||
invoice.append('items', item)
|
invoice.append('items', item)
|
||||||
|
|
||||||
# Taxes
|
# Taxes
|
||||||
# todo: tax template does not populate tax table
|
|
||||||
if self.tax_template:
|
if self.tax_template:
|
||||||
invoice.taxes_and_charges = self.tax_template
|
invoice.taxes_and_charges = self.tax_template
|
||||||
|
invoice.set_taxes()
|
||||||
|
|
||||||
# Due date
|
# Due date
|
||||||
invoice.append(
|
invoice.append(
|
||||||
@ -215,9 +214,6 @@ class Subscriptions(Document):
|
|||||||
)
|
)
|
||||||
return item_names
|
return item_names
|
||||||
|
|
||||||
def subscription_updated(self, invoice):
|
|
||||||
self.update_subscription_period()
|
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
"""
|
"""
|
||||||
To be called by task periodically. It checks the subscription and takes appropriate action
|
To be called by task periodically. It checks the subscription and takes appropriate action
|
||||||
|
@ -119,7 +119,7 @@ class TestSubscriptions(unittest.TestCase):
|
|||||||
subscription.process()
|
subscription.process()
|
||||||
|
|
||||||
self.assertEqual(len(subscription.invoices), 1)
|
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')
|
self.assertEqual(subscription.status, 'Past Due Date')
|
||||||
subscription.delete()
|
subscription.delete()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user