I have made a custom report in erpnext. In that, I can filter data by clicking add filter button. But I want to add that as a default filter. How can I fix it?
For more clarification here is the screenshot which I am expecting as default https://drive.google.com/file/d/1G8WGJiFKZMQfWR5Hqs8rwZxLrdGwwp6z/view?usp=sharing
Thanks in advance
1 Like
kartik
January 19, 2019, 10:20am
2
If it’s a Script report, you can refer to the below code to add a default value to the filter.
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname": "report_date",
"label": __("Posting Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today()
},
{
"fieldname": "finance_book",
"label": __("Finance Book"),
"fieldtype": "Link",
"options": "Finance Book"
},
{
"fieldname": "cost_center",
"label": __("Cost Center"),
2 Likes
How can this be done in a query report?
(Script report are not available as I am hosting on Frappe Cloud.)
Any suggestions for users who are not self-hosting? Ideally, this should be possible from the UI without the need to add a custom .js-script.
There is also an issue on this: Default values for filters in query report · Issue #25931 · frappe/erpnext · GitHub
nazari
February 13, 2022, 7:42am
5
same issue here, any suggestions and idea about adding default value to filters in query report?