On assignment notification is not send to the assigned user

This commit is contained in:
Rohit Waghchaure 2018-08-30 16:32:09 +05:30
parent 00fc9c9b1c
commit b66d3fe37c

View file

@ -163,4 +163,30 @@ def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE',
'notify': notify
}
arg["parenttype"] = "Assignment"
if arg and arg.get("notify"):
_notify(arg)
def _notify(args):
from frappe.utils import get_fullname, get_url
args = frappe._dict(args)
contact = args.contact
txt = args.txt
try:
if not isinstance(contact, list):
contact = [frappe.db.get_value("User", contact, "email") or contact]
frappe.sendmail(\
recipients=contact,
sender= frappe.db.get_value("User", frappe.session.user, "email"),
subject=_("New Message from {0}").format(get_fullname(frappe.session.user)),
template="new_message",
args={
"from": get_fullname(frappe.session.user),
"message": txt,
"link": get_url()
},
header=[_('New Message'), 'orange'])
except frappe.OutgoingEmailError:
pass