Notifications in custom app

Hi guys,
I’m trying to customize the notifications for the leave application in my custom app, I made a notification function and call it in my notifications file as such:

def get_notification_config():
return {
“for_doctype”: {
‘Leave Application’:‘mycustomApp.notifications.leave_application_notification_count’
and it raises me an error which is

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 53, in execute_cmd
return, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 923, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 255, in get_open_count
filters[fieldname] = name
TypeError: ‘unicode’ object does not support item assignment

So what I’m missing guys??

1 Like

@random.1 I don’t know what the function leave_application_notification_count is returning but it should be like this:

def get_notification_config():
    notifications = {
        "for_doctype": {
            "Coupons": {
                "status": ("in", ("Open", "Overdue"))
            "Cheques": {
                "status": "Open"

    doctype = [d for d in notifications.get('for_doctype')]
    for doc in frappe.get_all(
            filters={"name": ("not in", doctype),
                     'is_submittable': 1}):
        notifications["for_doctype"][] = {"docstatus": 0}

    return notifications

I think he mean using function instead of filters like frappe notifications

I created a new app in a new instance the error in one function in the file get_open_count

it does not test if the filter is not a dictionary.
it assumes that all references of the filter are dictionary.
I think you should make an issue with it.
best regards

1 Like