[refactor] used frappe.sendmail

This commit is contained in:
Rushabh Mehta
2014-09-16 14:57:31 +05:30
parent 5cdc8e560c
commit bf8715dba4
4 changed files with 16 additions and 21 deletions

View File

@@ -6,7 +6,6 @@ from frappe import _
import json
from frappe.utils import flt, cstr, nowdate, add_days, cint
from frappe.defaults import get_global_default
from frappe.email import sendmail
from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
class InvalidWarehouseCompany(frappe.ValidationError): pass
@@ -336,11 +335,11 @@ def send_email_notification(mr_list):
msg += "<tr><td>" + item.item_code + "</td><td>" + item.warehouse + "</td><td>" + \
cstr(item.qty) + "</td><td>" + cstr(item.uom) + "</td></tr>"
msg += "</table>"
sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg)
frappe.sendmail(recipients=email_list, subject='Auto Material Request Generation Notification', msg = msg)
def notify_errors(exceptions_list):
subject = "[Important] [ERPNext] Error(s) while creating Material Requests based on Re-order Levels"
msg = """Dear System Manager,
content = """Dear System Manager,
An error occured for certain Items while creating Material Requests based on Re-order level.
@@ -353,5 +352,5 @@ Please rectify these issues:
Regards,
Administrator""" % ("\n\n".join(exceptions_list),)
from frappe.utils.user import get_system_managers
sendmail(get_system_managers(), subject=subject, msg=msg)
from frappe.email import sendmail_to_system_managers
sendmail_to_system_managers(subject, content)