Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(minor): better way to override totals in gst sales beta report #2022

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ frappe.query_reports["GST Sales Register Beta"] = {

return value;
},

// Override datatable hook for column total calculation
get_datatable_options(datatable_options) {
datatable_options.hooks = {
columnTotal: custom_report_column_total,
};

return datatable_options;
},
};

function set_sub_category_options(report) {
Expand All @@ -113,12 +122,10 @@ function set_sub_category_options(report) {
}
}

frappe_report_column_total = frappe.utils.report_column_total;

// Override datatable hook for column total calculation
frappe.utils.report_column_total = function (...args) {
custom_report_column_total = function (...args) {
const summary_by = frappe.query_report.get_filter_value("summary_by");
if (summary_by !== "Overview") return frappe_report_column_total.apply(this, args);
if (summary_by !== "Overview")
return frappe.utils.report_column_total.apply(this, args);

const column_field = args[1].column.fieldname;
if (column_field === "description") return;
Expand Down