Set default report - ITS POSSIBLE

This question has been asked for years. So far no one has provided a way on how to do it. So is it just not possible? We could always edit the core files. But we are not savages :smiley:

If you don’t want to change the core file, just create a new report in the custom app.

I have. But I want that report to be default when I switch to report view.

Can you explain us bit be more?

Lets say I am on list view.

And I want to switch to report view to see all requested products.

image

I am by default show generic report.

What I want is to by default be shown my custom report.

It can’t be set directly. If you want an easy way to set it for the view, create a custom button on the list view. Then, set the default report when you click the button.

Hi @MrKovalski,

I did it. :wink: :rocket:

please apply it.

frappe.listview_settings['Lead'] = {
    refresh: function(listview) {
        const reportOption = document.querySelector('li[data-view="Report"] a');
        if (reportOption) {
            reportOption.addEventListener('click', function(event) {
                event.preventDefault();
                event.stopPropagation();
                window.location.href = '/app/lead/view/report/Lead Report Builder Report';
            });
        }
    }
};

Please set your Doctype and Report URL in the ListView client script.

Output:

3 Likes

Woah, nicely done. I thought it would be some dirty workaround. But this is it.

Didn’t know that u can override default buttons like that.