fix: New Dashboard Chart throws TypeError: format requires a mapping
closes #21250
This commit is contained in:
parent
a21412e12a
commit
70944cabb3
1 changed files with 14 additions and 1 deletions
|
|
@ -165,7 +165,8 @@ def get_script(report_name):
|
|||
script += f"\n\n//# sourceURL={scrub(report.name)}__custom"
|
||||
|
||||
if not script:
|
||||
script = "frappe.query_reports['%s']={}" % report_name
|
||||
filters = json.dumps([prepare_filter(filter) for filter in report.filters])
|
||||
script = "frappe.query_reports['%s']={ 'filters': %s}" % (report_name, filters)
|
||||
|
||||
return {
|
||||
"script": render_include(script),
|
||||
|
|
@ -174,6 +175,18 @@ def get_script(report_name):
|
|||
}
|
||||
|
||||
|
||||
def prepare_filter(filter):
|
||||
filter = {
|
||||
"fieldname": filter.fieldname,
|
||||
"label": filter.label,
|
||||
"fieldtype": filter.fieldtype,
|
||||
"width": "80",
|
||||
"options": filter.options,
|
||||
"reqd": 1
|
||||
}
|
||||
return filter
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@frappe.read_only()
|
||||
def run(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue