Merge branch 'wsgi' of github.com:webnotes/erpnext into wsgi

This commit is contained in:
Nabin Hait
2013-10-16 11:19:09 +05:30
19 changed files with 172 additions and 54 deletions

View File

@@ -76,14 +76,17 @@ class DocType():
sender = self.doc.send_from or webnotes.utils.get_formatted_email(self.doc.owner)
from webnotes.utils.email_lib.bulk import send
webnotes.conn.auto_commit_on_many_writes = True
if not webnotes.flags.in_test:
webnotes.conn.auto_commit_on_many_writes = True
send(recipients = self.recipients, sender = sender,
subject = self.doc.subject, message = self.doc.message,
doctype = self.send_to_doctype, email_field = "email_id",
ref_doctype = self.doc.doctype, ref_docname = self.doc.name)
webnotes.conn.auto_commit_on_many_writes = False
if not webnotes.flags.in_test:
webnotes.conn.auto_commit_on_many_writes = False
def validate_send(self):
if self.doc.fields.get("__islocal"):

View File

@@ -45,20 +45,23 @@ test_records =[
"subject": "_Test Newsletter to Lead",
"send_to_type": "Lead",
"lead_source": "All",
"message": "This is a test newsletter"
"message": "This is a test newsletter",
"send_from": "admin@example.com"
}],
[{
"doctype": "Newsletter",
"subject": "_Test Newsletter to Contact",
"send_to_type": "Contact",
"contact_type": "Customer",
"message": "This is a test newsletter"
"message": "This is a test newsletter",
"send_from": "admin@example.com"
}],
[{
"doctype": "Newsletter",
"subject": "_Test Newsletter to Custom",
"send_to_type": "Custom",
"email_list": "test_custom@example.com, test_custom1@example.com, test_custom2@example.com",
"message": "This is a test newsletter"
"message": "This is a test newsletter",
"send_from": "admin@example.com"
}],
]