Fix: Notify via email on new post on my company page
diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py
index dfeb30f..c239162 100644
--- a/erpnext/home/page/my_company/my_company.py
+++ b/erpnext/home/page/my_company/my_company.py
@@ -119,17 +119,26 @@
else:
fn = webnotes.user.name
- from webnotes.utils.email_lib import sendmail
- from setup.doctype.notification_control.notification_control import get_formatted_message
-
message = '''A new comment has been posted on your page by %s:
<b>Comment:</b> %s
To answer, please login to your erpnext account!
+
+ <a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
''' % (fn, arg['comment'])
- sendmail([arg['uid']], webnotes.user.name, get_formatted_message('New Comment', message), fn + ' has posted a new comment')
+ from webnotes.model.code import get_obj
+ note = get_obj('Notification Control')
+ email_msg = note.prepare_message({
+ 'type': 'New Comment',
+ 'message': message
+ })
+
+ sender = webnotes.user.name!='Administrator' and webnotes.user.name or 'support+admin_post@erpnext.com'
+
+ from webnotes.utils.email_lib import sendmail
+ sendmail([arg['uid']], sender, email_msg, fn + ' has posted a new comment')
#
# update read messages
diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py
index 216c46b..ae37cbd 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.py
+++ b/erpnext/setup/doctype/notification_control/notification_control.py
@@ -55,9 +55,9 @@
"""
Prepares message body
"""
- if args.get('type') and args.get('doctype'):
+ if args.get('type'):
msg_dict = {}
- msg_dict['message'] = self.get_message(args.get('type'))
+ msg_dict['message'] = args.get('message') or self.get_message(args.get('type'))
msg_dict['company'] = Document('Control Panel', 'Control Panel').company_name
msg_dict['salutation'] = "Hi" + (args.get('contact_name') and (" " + args.get('contact_name')) or "")
msg_dict['send_from'] = webnotes.conn.sql("""\