Script report - Add Total remove not working

Unticked “Add Total” and added total by coding. after hosting the reports showing the total in reports. How we can remove the add total from report… ?

Approach: Modify Report Script

  1. Access Custom Script:

    • If you have already customized the report using a custom script, you need to modify the script to exclude the “Add Total” row.
  2. Identify the Total Row:

    • Typically, the total row can be identified by a specific label or value in one of the columns. You need to write a condition to exclude this row.
  3. Modify Report Data:

    • Modify the data returned by the report to filter out the total row before rendering it on the frontend.

Example: Custom Script for Report

Here’s an example of how you can achieve this in a custom report script:

Step 1: Open the Report Script

Go to your custom report’s script file. This is typically found in your custom app under:


Step 2: Modify the Data Handling

Add logic to filter out the total row from the data. Here’s a sample script demonstrating how to achieve this:

frappe.query_reports["Your Custom Report"] = {
    "filters": [
        // your existing filters here

    "onload": function(report) {
        // Code to run on report load

    "formatter": function(value, row, column, data, default_formatter) {
        // Formatter function if needed
        return default_formatter(value, row, column, data);

    "get_data": function() {
        // Fetch the original data
        const original_data = frappe.query_report.get_data();

        // Filter out the total row
        const filtered_data = original_data.filter(row => {
            return row.some(column_value => column_value !== 'Total');

        return filtered_data;

In this example, frappe.query_report.get_data() is a placeholder for the method you use to get your report data. You will need to replace it with the actual method or variable that contains your report data.

Step 3: Update Report Settings

Ensure your report settings are updated to use this custom script.

  1. Go to the Report Doctype in Frappe/ERPNext.
  2. Locate your custom report.
  3. Ensure that the script path or the custom script is correctly linked to your report.

Approach: Server-Side Scripting

If you prefer to handle this on the server side before the data is sent to the client:

  1. Modify the Report Python Script:

    • Open the Python script for your report, typically located at:

  2. Filter Out Total Row:

    • Add logic to filter out the total row in the script that prepares the report data.
    def execute(filters=None):
        columns, data = [], []
        # your existing code to fetch data
        data = get_report_data(filters)
        # Filter out the total row
        data = [row for row in data if not is_total_row(row)]
        return columns, data
    def is_total_row(row):
        # Replace with your condition to identify the total row
        return 'Total' in row
  3. Update Report Configuration:

    • Ensure your report is configured to use this updated script.

Final Steps

  • Test the Changes: Ensure that the report works as expected without the total row.
  • Clear Cache: Sometimes, clearing the cache helps in reflecting the latest changes.
    bench clear-cache
    bench clear-website-cache
    bench restart