diff --git a/frappe/core/page/dashboard/dashboard.py b/frappe/core/page/dashboard/dashboard.py index 1f4eaee783..3496948d98 100644 --- a/frappe/core/page/dashboard/dashboard.py +++ b/frappe/core/page/dashboard/dashboard.py @@ -3,7 +3,8 @@ from __future__ import unicode_literals import json import frappe -from frappe.utils import add_to_date +from frappe import _ +from frappe.utils import add_to_date, get_link_to_form def cache_source(function): @@ -29,7 +30,21 @@ def cache_source(function): return wrapper def generate_and_cache_results(chart, chart_name, function, cache_key): - results = function(chart_name = chart_name) + try: + results = function(chart_name = chart_name) + except TypeError as e: + if e.message == "'NoneType' object is not iterable": + # Probably because of invalid link filter + # + # Note: Do not try to find the right way of doing this because + # it results in an inelegant & inefficient solution + # ref: https://github.com/frappe/frappe/pull/9403 + frappe.throw(_('Please check the filter values set for Dashboard Chart: {}').format( + get_link_to_form(chart.doctype, chart.name)), title=_('Invalid Filter Value')) + return + else: + raise + frappe.cache().set_value(cache_key, json.dumps(results, default=str)) frappe.db.set_value("Dashboard Chart", chart_name, "last_synced_on", frappe.utils.now(), update_modified = False) return results