I have created a Script Report and a Number Card based on that report.
In my report JavaScript, I am setting default date filters dynamically like this:
frappe.query_reports[“Delivery Note Pending Report”] = {
“filters”: [
{
“fieldname”: “from_date”,
“label”: __(“From Date”),
“fieldtype”: “Date”,
“default”: frappe.datetime.add_months(frappe.datetime.get_today(), -9)
},
{
“fieldname”: “to_date”,
“label”: __(“To Date”),
“fieldtype”: “Date”,
“default”: frappe.datetime.get_today()
}
]
};
Because the default from_date and to_date values change every day
- The Number Card shows “Not Saved”
- The updated dates are visible only after I open the Number Card and click Save manually
I want the Number Card to be automatically saved whenever:
-
The report default dates change (daily)
-
Or a scheduler / server script updates the dates in the backend
Any guidance or best practices would be really helpful.
