From 4a4a6594d18e51abb1d50e928329a6a070fe5ce0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta <rmehta@gmail.com> Date: Fri, 29 May 2015 15:56:24 +0530 Subject: [PATCH] [minor] [refactor] --- erpnext/crm/doctype/newsletter_list/newsletter_list.py | 7 +++++-- erpnext/setup/doctype/naming_series/naming_series.py | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.py b/erpnext/crm/doctype/newsletter_list/newsletter_list.py index 1eb95eac17..3a580d333b 100644 --- a/erpnext/crm/doctype/newsletter_list/newsletter_list.py +++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.py @@ -44,11 +44,14 @@ class NewsletterList(Document): return self.update_total_subscribers() def update_total_subscribers(self): - self.total_subscribers = frappe.db.sql("""select count(*) from `tabNewsletter List Subscriber` - where newsletter_list=%s""", self.name)[0][0] + self.total_subscribers = self.get_total_subscribers() self.db_update() return self.total_subscribers + def get_total_subscribers(self): + return frappe.db.sql("""select count(*) from `tabNewsletter List Subscriber` + where newsletter_list=%s""", self.name)[0][0] + def on_trash(self): for d in frappe.get_all("Newsletter List Subscriber", "name", {"newsletter_list": self.name}): frappe.delete_doc("Newsletter List Subscriber", d.name) diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 1b986827c2..5105fcd795 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -12,7 +12,6 @@ from frappe.model.document import Document class NamingSeriesNotSetError(frappe.ValidationError): pass class NamingSeries(Document): - def get_transactions(self, arg=None): doctypes = list(set(frappe.db.sql_list("""select parent from `tabDocField` where fieldname='naming_series'""")