Created
December 26, 2014 06:36
-
-
Save gangadhar-kadam/173132e305d40946f068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@cmd | |
def run_notification(app_name=None): | |
from erpnext.setup.doctype.site_master.site_master import send_confirmation_emails | |
send_confirmation_emails() | |
frappe.destroy() | |
below function is written in site_master doctype | |
def run_notification() | |
import MySQLdb | |
conn = MySQLdb.connect (host = "localhost",user = "stitch7",passwd = "iHfVPACi5GZGxjd7",db = "stitch7") | |
from frappe.utils import get_url, cstr | |
cur = conn.cursor() | |
usr=[] | |
cur.execute("select distinct(parent) from `tabUserRole` where role='HR Manager' and parent<> 'Administrator'") | |
for row in cur.fetchall() : | |
usr.append(row[0]) | |
cur.close () | |
conn.close () | |
import frappe | |
frappe.connect(site='demo') # as connected from to another db from mysql was giving error for send email so reconnected to default frappe site | |
from frappe.utils.email_lib import sendmail | |
sendmail(recipients=usr, msg='msg', subject='Not Confirmed Employees list') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment