diff --git a/erpnext/hr/doctype/employee/employee.txt b/erpnext/hr/doctype/employee/employee.txt index 16314dba62..795f4de4af 100644 --- a/erpnext/hr/doctype/employee/employee.txt +++ b/erpnext/hr/doctype/employee/employee.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-07 09:04:18", "docstatus": 0, - "modified": "2014-01-20 17:48:40", + "modified": "2014-02-03 18:06:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -457,6 +457,12 @@ "fieldtype": "Data", "label": "Personal Email" }, + { + "doctype": "DocField", + "fieldname": "unsubscribed", + "fieldtype": "Check", + "label": "Unsubscribed" + }, { "doctype": "DocField", "fieldname": "emergency_contact_details", diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py index d07d8730ed..68f1d95285 100644 --- a/erpnext/support/doctype/newsletter/newsletter.py +++ b/erpnext/support/doctype/newsletter/newsletter.py @@ -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: