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",
|
type="Mention",
|
||||||
message=doc.content,
|
message=doc.content,
|
||||||
comment=doc.name,
|
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):
|
if frappe.db.exists("CRM Notification", values):
|
||||||
return
|
return
|
||||||
frappe.get_doc(values).insert()
|
frappe.get_doc(values).insert()
|
||||||
|
|||||||
@ -18,9 +18,6 @@ def get_notifications():
|
|||||||
|
|
||||||
_notifications = []
|
_notifications = []
|
||||||
for notification in notifications:
|
for notification in notifications:
|
||||||
reference_doc = frappe.get_value(
|
|
||||||
"Comment", notification.comment, ["reference_doctype", "reference_name"]
|
|
||||||
)
|
|
||||||
_notifications.append(
|
_notifications.append(
|
||||||
{
|
{
|
||||||
"creation": notification.creation,
|
"creation": notification.creation,
|
||||||
@ -35,10 +32,12 @@ def get_notifications():
|
|||||||
"read": notification.read,
|
"read": notification.read,
|
||||||
"comment": notification.comment,
|
"comment": notification.comment,
|
||||||
"reference_doctype": "deal"
|
"reference_doctype": "deal"
|
||||||
if reference_doc[0] == "CRM Deal"
|
if notification.reference_doctype == "CRM Deal"
|
||||||
else "lead",
|
else "lead",
|
||||||
"reference_name": reference_doc[1],
|
"reference_name": notification.reference_name,
|
||||||
"route_name": "Deal" if reference_doc[0] == "CRM Deal" else "Lead",
|
"route_name": "Deal"
|
||||||
|
if notification.reference_doctype == "CRM Deal"
|
||||||
|
else "Lead",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"from_user",
|
"from_user",
|
||||||
"type",
|
"type",
|
||||||
|
"reference_doctype",
|
||||||
|
"reference_name",
|
||||||
"column_break_dduu",
|
"column_break_dduu",
|
||||||
"to_user",
|
"to_user",
|
||||||
"comment",
|
"comment",
|
||||||
@ -62,11 +64,23 @@
|
|||||||
"fieldname": "message",
|
"fieldname": "message",
|
||||||
"fieldtype": "HTML Editor",
|
"fieldtype": "HTML Editor",
|
||||||
"label": "Message"
|
"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,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-01-29 20:03:40.102839",
|
"modified": "2024-01-30 01:04:27.946030",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "FCRM",
|
"module": "FCRM",
|
||||||
"name": "CRM Notification",
|
"name": "CRM Notification",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user