From ea8ff071cb3e36b2eafb94c2555195a61b1499f8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Jun 2012 14:23:48 +0530 Subject: [PATCH 1/3] error fixed in reorder item email notification --- erpnext/stock/doctype/bin/bin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 22ce431e16..229fee17f9 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -17,13 +17,14 @@ # Please edit this list and import only required elements import webnotes -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add +from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add from webnotes.model import db_exists from webnotes.model.doc import Document, addchild, getchildren, make_autoname from webnotes.model.doclist import getlist, copy_doclist from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax from webnotes import session, form, is_testing, msgprint, errprint + set = webnotes.conn.set sql = webnotes.conn.sql get_value = webnotes.conn.get_value @@ -382,11 +383,11 @@ class DocType: def send_email_notification(self,doc_type,doc_name): """ Notify user about auto creation of indent""" - + + from webnotes.utils.email_lib import sendmail email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")] - msg1='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate()) - sendmail(email_list, sender='automail@webnotestech.com', \ - subject='Auto Purchase Request Generation Notification', parts=[['text/plain',msg1]]) + msg='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate()) + sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg) From d8fd8cfe1b9aa3f7354ec36f15d18c042e07ec04 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Jun 2012 14:30:57 +0530 Subject: [PATCH 2/3] error fixed in reorder item email notification --- erpnext/stock/doctype/bin/bin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 229fee17f9..c9a700c9e7 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -385,7 +385,7 @@ class DocType: """ Notify user about auto creation of indent""" from webnotes.utils.email_lib import sendmail - email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")] + email_list=[d[0] for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")] msg='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate()) sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg) From 4676891cbfc468fc9872f9cec2cca745dff7b749 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Jun 2012 15:04:38 +0530 Subject: [PATCH 3/3] error fixed in reorder item email notification --- erpnext/stock/doctype/bin/bin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index c9a700c9e7..f2cd873e0f 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -385,7 +385,7 @@ class DocType: """ Notify user about auto creation of indent""" from webnotes.utils.email_lib import sendmail - email_list=[d[0] for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")] + email_list=[d[0] for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') and parent not in ('Administrator', 'All', 'Guest')")] msg='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate()) sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg)