From 0b0600498686dca621e218a839209d7d1133b40b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 26 Jun 2012 12:18:41 +0530 Subject: [PATCH 1/2] delete unwanted doctypes of website settings --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 03c0f27dd66..23ce8fa2273 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -452,4 +452,9 @@ patch_list = [ 'patch_file': 'alter_tabsessions', 'description': "alter tabsessions to change user column definition" }, + { + 'patch_module': 'patches.april_2012', + 'patch_file': 'delete_about_contact', + 'description': "delete depracated doctypes of website module" + }, ] \ No newline at end of file From 74962a92131ccbe2f6298be4c732f8b2210ca7a6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 26 Jun 2012 12:47:14 +0530 Subject: [PATCH 2/2] auto create email digest after setup is completed --- .../doctype/setup_control/setup_control.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py index bcdd0938da9..444b796f3cc 100644 --- a/erpnext/setup/doctype/setup_control/setup_control.py +++ b/erpnext/setup/doctype/setup_control/setup_control.py @@ -89,6 +89,8 @@ class DocType: self.set_cp_defaults(**cp_args) self.create_feed_and_todo() + + self.create_email_digest() webnotes.clear_cache() msgprint("Company setup is complete") @@ -127,6 +129,44 @@ class DocType: d.reference_type = 'Supplier' d.save(1) + def create_email_digest(self): + """ + create a default weekly email digest + * Weekly Digest + * For all companies + * Recipients: System Managers + * Full content + * Enabled by default + """ + import webnotes + companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1) + + import webnotes.utils + system_managers = webnotes.utils.get_system_managers_list() + if not system_managers: return + + from webnotes.model.doc import Document + for company in companies_list: + if company and company[0]: + edigest = Document('Email Digest') + edigest.name = "Default Weekly Digest - " + company[0] + edigest.company = company[0] + edigest.frequency = 'Weekly' + edigest.recipient_list = "\n".join(system_managers) + for f in ['new_leads', 'new_enquiries', 'new_quotations', + 'new_sales_orders', 'new_purchase_orders', + 'new_transactions', 'payables', 'payments', + 'expenses_booked', 'invoiced_amount', 'collections', + 'income', 'bank_balance', 'stock_below_rl', + 'income_year_to_date', 'enabled']: + edigest.fields[f] = 1 + exists = webnotes.conn.sql("""\ + SELECT name FROM `tabEmail Digest` + WHERE name = %s""", edigest.name) + if (exists and exists[0]) and exists[0][0]: + continue + else: + edigest.save(1) # Get Fiscal year Details # ------------------------