Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2012-06-27 10:12:21 +05:30
commit 5a24749456
2 changed files with 45 additions and 0 deletions

View File

@ -452,4 +452,9 @@ patch_list = [
'patch_file': 'alter_tabsessions', 'patch_file': 'alter_tabsessions',
'description': "alter tabsessions to change user column definition" '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"
},
] ]

View File

@ -90,6 +90,8 @@ class DocType:
self.create_feed_and_todo() self.create_feed_and_todo()
self.create_email_digest()
webnotes.clear_cache() webnotes.clear_cache()
msgprint("Company setup is complete") msgprint("Company setup is complete")
@ -127,6 +129,44 @@ class DocType:
d.reference_type = 'Supplier' d.reference_type = 'Supplier'
d.save(1) 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 # Get Fiscal year Details
# ------------------------ # ------------------------