Add Event Link to Delivery Note Dashboard

I’m trying to add link refers to Enevnt Document to Delivery Note Dashboard but i got this error

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1030, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 282, in get_open_count
filters[fieldname] = name
TypeError: ‘unicode’ object does not support item assignment

delivery_note_dashboard.py

from future import unicode_literals
from frappe import _

def get_data():
return {
‘fieldname’: ‘delivery_note’,
‘non_standard_fieldnames’: {
‘Stock Entry’: ‘delivery_note_no’,
‘Quality Inspection’: ‘reference_name’,
‘Auto Repeat’: ‘reference_document’,
},
‘internal_links’: {
‘Sales Order’: [‘items’, ‘against_sales_order’],
# ‘Event’: [‘items’, ‘Event’],
},
‘transactions’: [
{
‘label’: _(‘Related’),
‘items’: [‘Sales Invoice’, ‘Packing Slip’, ‘Delivery Trip’]
},
{
‘label’: _(‘Reference’),
‘items’: [‘Sales Order’, ‘Quality Inspection’]
},
{
‘label’: _(‘Returns’),
‘items’: [‘Stock Entry’]
},
{
‘label’: _(‘Subscription’),
‘items’: [‘Auto Repeat’]
},
{
‘label’: _(‘Events’),
‘items’: [‘Event’]
},
]
}

there is a bug in the system which prevent adding event into dashboard

def get_notification_config():
return {
“for_doctype”: {
“Error Log”: {“seen”: 0},
“Communication”: {“status”: “Open”, “communication_type”: “Communication”},
“ToDo”: “frappe.core.notifications.get_things_todo”,
“Event”: “frappe.core.notifications.get_todays_events”,
“Error Snapshot”: {“seen”: 0, “parent_error_snapshot”: None},
“Workflow Action”: {“status”: ‘Open’}
},
“for_other”: {
“Likes”: “frappe.core.notifications.get_unseen_likes”,
“Email”: “frappe.core.notifications.get_unread_emails”,
},
“for_module”: {
“Social”: “frappe.social.doctype.post.post.get_unseen_post_count”
}
}

the code extracted as above from frappe.core.notifications.py methon get_notification_config, for doctype event a function other than a dict as filtering condition is returned, actually the function is relevant for the calendar view of event doctype itself, for embed event in other doctype’s dashboard, this function is irrelevant, so after changed the relevant code in frappe.desk.notifications.py as below

	if filters:
		# get the fieldname for the current document
		# we only need open documents related to the current document
		if isinstance(filters, dict):
			filters[fieldname] = name
		else:
			filters = None
		total = len(frappe.get_all(d, fields='name',
			filters=filters, limit=100, distinct=True, ignore_ifnull=True))
		data['open_count'] = total

Dear @szufisher
Thanks for your response
but the above code cause system error not loading and i got the “sorry will come back soon” massage

check your log, pay attention to the indent/space.

if further assistance needed, I can be reached via skype szu_fisher

my working code