fix: notification text is not getting set
This commit is contained in:
parent
554444c363
commit
674bb28239
@ -18,16 +18,18 @@ def notify_mentions(doc):
|
|||||||
if not content:
|
if not content:
|
||||||
return
|
return
|
||||||
mentions = extract_mentions(content)
|
mentions = extract_mentions(content)
|
||||||
|
reference_doc = frappe.get_doc(doc.reference_doctype, doc.reference_name)
|
||||||
for mention in mentions:
|
for mention in mentions:
|
||||||
owner = frappe.get_cached_value("User", doc.owner, "full_name")
|
owner = frappe.get_cached_value("User", doc.owner, "full_name")
|
||||||
doctype = doc.reference_doctype
|
doctype = doc.reference_doctype
|
||||||
if doctype.startswith("CRM "):
|
if doctype.startswith("CRM "):
|
||||||
doctype = doctype[4:].lower()
|
doctype = doctype[4:].lower()
|
||||||
|
name = reference_doc.lead_name or name if doctype == "lead" else reference_doc.organization or reference_doc.lead_name or name
|
||||||
notification_text = f"""
|
notification_text = f"""
|
||||||
<div class="mb-2 leading-5 text-gray-600">
|
<div class="mb-2 leading-5 text-gray-600">
|
||||||
<span class="font-medium text-gray-900">{ owner }</span>
|
<span class="font-medium text-gray-900">{ owner }</span>
|
||||||
<span>{ _('mentioned you in {0}').format(doctype) }</span>
|
<span>{ _('mentioned you in {0}').format(doctype) }</span>
|
||||||
<span class="font-medium text-gray-900">{ doc.reference_name }</span>
|
<span class="font-medium text-gray-900">{ name }</span>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
notify_user({
|
notify_user({
|
||||||
|
|||||||
@ -52,8 +52,8 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
|||||||
if doctype.startswith("CRM "):
|
if doctype.startswith("CRM "):
|
||||||
doctype = doctype[4:].lower()
|
doctype = doctype[4:].lower()
|
||||||
|
|
||||||
if doctype in ["CRM Lead", "CRM Deal"]:
|
if doctype in ["lead", "deal"]:
|
||||||
name = reference_doc.lead_name or name if doctype == "CRM Lead" else reference_doc.organization or reference_doc.lead_name or name
|
name = reference_doc.lead_name or name if doctype == "lead" else reference_doc.organization or reference_doc.lead_name or name
|
||||||
|
|
||||||
if is_cancelled:
|
if is_cancelled:
|
||||||
return f"""
|
return f"""
|
||||||
@ -76,7 +76,7 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
|||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if doc.reference_type == "CRM Task":
|
if doctype == "task":
|
||||||
if is_cancelled:
|
if is_cancelled:
|
||||||
return f"""
|
return f"""
|
||||||
<div class="mb-2 leading-5 text-gray-600">
|
<div class="mb-2 leading-5 text-gray-600">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user