webnotes/erpnext#869 newsletter to send to employees

This commit is contained in:
Akhilesh Darjee
2014-02-03 19:28:36 +05:30
parent 81578d2e77
commit f1c3537924
2 changed files with 10 additions and 2 deletions

View File

@@ -70,6 +70,8 @@ class DocType():
elif self.doc.send_to_type=="Employee":
self.send_to_doctype = "Employee"
self.email_field = "company_email"
return webnotes.conn.sql_list("""select
if(ifnull(company_email, '')!='', company_email, personal_email) as email_id
from `tabEmployee` where status='Active'""")
@@ -94,7 +96,7 @@ class DocType():
send(recipients = self.recipients, sender = sender,
subject = self.doc.subject, message = self.doc.message,
doctype = self.send_to_doctype, email_field = "email_id",
doctype = self.send_to_doctype, email_field = self.email_field or "email_id",
ref_doctype = self.doc.doctype, ref_docname = self.doc.name)
if not webnotes.flags.in_test: