i have this script , when i implemented it there is no data to show i just see this massage ‘Nothing to show’
my code
def fetch_sales_incentives():
return frappe.db.sql("""
SELECT
e.employee AS Sales_Officer,
COALESCE(sp.sales_person, 'N/A') AS Sales_Person,
e.designation AS Designation,
e.custom_related_business AS Related_Business,
COALESCE(i.incentive_amount, 0) AS Incentive_Amount,
i.date AS Incentive_Date
FROM
`tabIncentives` i
LEFT JOIN
`tabSales Team` st ON st.name = i.sales_team
LEFT JOIN
`tabSales Person` sp ON sp.name = st.sales_person
LEFT JOIN
`tabEmployee` e ON e.employee = sp.employee
WHERE
e.designation = 'Sales Officer'
ORDER BY
i.date DESC
""", as_dict=True)
def execute(filters=None):
data = fetch_sales_incentives()
columns = [
{"fieldname": "Sales_Officer", "label": _("Sales Officer"), "fieldtype": "Data", "width": 150},
{"fieldname": "Sales_Person", "label": _("Sales Person"), "fieldtype": "Data", "width": 150},
{"fieldname": "Designation", "label": _("Designation"), "fieldtype": "Data", "width": 150},
{"fieldname": "Related_Business", "label": _("Related Business"), "fieldtype": "Data", "width": 150},
{"fieldname": "Incentive_Amount", "label": _("Incentive Amount"), "fieldtype": "Currency", "width": 100},
{"fieldname": "Incentive_Date", "label": _("Incentive Date"), "fieldtype": "Date", "width": 100},
]
return columns, data