From 1ea50559677ede66bf9b5a2119df9629683ac4b1 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Mon, 26 Feb 2018 20:17:59 +0100 Subject: [PATCH] fix another date comparison bug --- erpnext/accounts/doctype/subscriptions/subscriptions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/subscriptions/subscriptions.py b/erpnext/accounts/doctype/subscriptions/subscriptions.py index 6b6fc5ff98..457b27706e 100644 --- a/erpnext/accounts/doctype/subscriptions/subscriptions.py +++ b/erpnext/accounts/doctype/subscriptions/subscriptions.py @@ -72,12 +72,12 @@ class Subscriptions(Document): if not current_invoice: return False else: - return nowdate() > current_invoice.due_date + return getdate(nowdate()) > getdate(current_invoice.due_date) def get_current_invoice(self): if len(self.invoices): current = self.invoices[-1] - doc = frappe.get_doc('Sales Invoice', current) + doc = frappe.get_doc('Sales Invoice', current.invoice) return doc def is_new_subscription(self): @@ -103,6 +103,7 @@ class Subscriptions(Document): invoice.save() invoice.submit() self.append('invoices', {'invoice': invoice.name}) + self.save() # Validates all over again but we don't mind self.subscription_updated(invoice) return invoice