Has anyone successfully created a custom Script Report in V12 or V13 UI?

Hi ,

We’ve been trying to use the Script Report feature in ERPNext to create a custom report but it doesn’t seem to be working. It keeps returning an error:

File "/home/frappe/benches/bench-version-12-2021-06-22/apps/frappe/frappe/desk/query_report.py", line 68, in generate_report_result
    columns = [get_column_as_dict(col) for col in columns]
TypeError: 'NoneType' object is not iterable

Please note that this is a custom report meaning that the “Is Standard” field is set to ‘No’

If anyone could share some insights, I would be most grateful

Below is the simple code we’re testing:


frappe.query_reports["Sales Commissions"] = {
    "filters": [
            "label": __("Customer"),
            "fieldtype": "Link",
            "options": "Customer",
            "default": "Test Customer"


def execute(filters=None):
    columns, data = [], []
    columns = [
    invoices = frappe.db.sql("SELECT posting_date, customer FROM `tabSales Invoice`;", as_dict=1)
    for invoice in invoices:
        data.append([invoice['posting_date'], invoice['customer']])
    return columns, data