fix: added reference doctype and name in notification doctype
This commit is contained in:
parent
f94c566b70
commit
a0ba6dd7a1
@ -22,10 +22,10 @@ def notify_mentions(doc):
|
||||
type="Mention",
|
||||
message=doc.content,
|
||||
comment=doc.name,
|
||||
reference_doctype=doc.reference_doctype,
|
||||
reference_name=doc.reference_name,
|
||||
)
|
||||
# Why mention oneself?
|
||||
# if values.from_user == values.to_user:
|
||||
# continue
|
||||
|
||||
if frappe.db.exists("CRM Notification", values):
|
||||
return
|
||||
frappe.get_doc(values).insert()
|
||||
|
||||
@ -18,9 +18,6 @@ def get_notifications():
|
||||
|
||||
_notifications = []
|
||||
for notification in notifications:
|
||||
reference_doc = frappe.get_value(
|
||||
"Comment", notification.comment, ["reference_doctype", "reference_name"]
|
||||
)
|
||||
_notifications.append(
|
||||
{
|
||||
"creation": notification.creation,
|
||||
@ -35,10 +32,12 @@ def get_notifications():
|
||||
"read": notification.read,
|
||||
"comment": notification.comment,
|
||||
"reference_doctype": "deal"
|
||||
if reference_doc[0] == "CRM Deal"
|
||||
if notification.reference_doctype == "CRM Deal"
|
||||
else "lead",
|
||||
"reference_name": reference_doc[1],
|
||||
"route_name": "Deal" if reference_doc[0] == "CRM Deal" else "Lead",
|
||||
"reference_name": notification.reference_name,
|
||||
"route_name": "Deal"
|
||||
if notification.reference_doctype == "CRM Deal"
|
||||
else "Lead",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
"field_order": [
|
||||
"from_user",
|
||||
"type",
|
||||
"reference_doctype",
|
||||
"reference_name",
|
||||
"column_break_dduu",
|
||||
"to_user",
|
||||
"comment",
|
||||
@ -62,11 +64,23 @@
|
||||
"fieldname": "message",
|
||||
"fieldtype": "HTML Editor",
|
||||
"label": "Message"
|
||||
},
|
||||
{
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"label": "Reference Doc",
|
||||
"options": "reference_doctype"
|
||||
},
|
||||
{
|
||||
"fieldname": "reference_doctype",
|
||||
"fieldtype": "Link",
|
||||
"label": "Reference Doctype",
|
||||
"options": "DocType"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-01-29 20:03:40.102839",
|
||||
"modified": "2024-01-30 01:04:27.946030",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Notification",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user