Merge pull request #6035 from rohitwaghchaure/email_notify_not_working
On assignment notification is not sent to the assigned user
This commit is contained in:
commit
030d6d89f0
1 changed files with 27 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue