1234567891011121314151617181920212223 |
- def notify_assignment(shared_by, doctype, doc_name, everyone):
- if not (shared_by and doctype and doc_name) or everyone: return
- from frappe.utils import get_fullname
- title_field = frappe.get_meta(doctype).get_title_field()
- title = doc_name if title_field == "name" else \
- frappe.db.get_value(doctype, doc_name, title_field)
- reference_user = get_fullname(frappe.session.user)
- notification_message = _('{0} shared a document {1} {2} with you').format(
- frappe.bold(reference_user), frappe.bold(doctype), frappe.bold(title))
- notification_doc = {
- 'type': 'Share',
- 'document_type': doctype,
- 'subject': notification_message,
- 'document_name': doc_name,
- 'from_user': frappe.session.user
- }
- enqueue_create_notification(shared_by, notification_doc)
|