From 5d9217ab29d2f335b862a06f17f07151c8684051 Mon Sep 17 00:00:00 2001 From: casesolved-co-uk Date: Wed, 24 Mar 2021 04:01:18 +0000 Subject: [PATCH] fix: minor bugs and improvements --- .../accounts/report/tax_detail/tax_detail.js | 22 +++++++++---------- .../accounts/report/tax_detail/tax_detail.py | 4 +++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/erpnext/accounts/report/tax_detail/tax_detail.js b/erpnext/accounts/report/tax_detail/tax_detail.js index 6049000404..5da63dec57 100644 --- a/erpnext/accounts/report/tax_detail/tax_detail.js +++ b/erpnext/accounts/report/tax_detail/tax_detail.js @@ -81,7 +81,6 @@ erpnext.TaxDetail = class TaxDetail { } show_footer_message() { // The last thing to run after datatable_render in refresh() - console.log('show_footer_message'); this.super.show_footer_message.apply(this.qr); if (this.qr.report_name !== 'Tax Detail') { this.set_value_options(); @@ -97,7 +96,6 @@ erpnext.TaxDetail = class TaxDetail { // Infrequent report build (onload), load filters & data // super function runs a refresh() serially // already run within frappe.run_serially - console.log('refresh_report'); this.loading = true; this.super.refresh_report.apply(this.qr); if (this.qr.report_name !== 'Tax Detail') { @@ -115,21 +113,23 @@ erpnext.TaxDetail = class TaxDetail { load_report() { // One-off report build like titles, menu, etc // Run when this object is created which happens in qr.load_report - console.log('load_report'); this.qr.menu_items = this.get_menu_items(); } get_menu_items() { - // Replace save button + // Replace Save, remove Add Column let new_items = []; - const label = __('Save'); + const save = __('Save'); + const addColumn = __('Add Column'); for (let item of this.qr.menu_items) { - if (item.label === label) { + if (item.label === save) { new_items.push({ - label: label, - action: this.save_report, + label: save, + action: () => this.save_report(), standard: false }); + } else if (item.label === addColumn) { + // Don't add } else { new_items.push(item); } @@ -279,9 +279,6 @@ erpnext.TaxDetail = class TaxDetail { } } create_controls() { - if (this.controls) { - return; - } let controls = {}; // SELECT in data.js controls['section_name'] = this.qr.page.add_field({ @@ -389,7 +386,8 @@ erpnext.TaxDetail = class TaxDetail { To specify what data goes in each section, specify column filters in the data table, then save with Add Filter. Each section can have multiple filters added but be careful with the duplicated data rows. You can specify which Currency column will be summed for each filter in the final report with the Value Column - select box. Once you're done, hit Save & Run.`); + select box. Use the Show Detail box to see the data rows included in each section in the final report. + Once you're done, hit Save & Run.`); this.qr.$report_footer.append(`
${help}
`); } } diff --git a/erpnext/accounts/report/tax_detail/tax_detail.py b/erpnext/accounts/report/tax_detail/tax_detail.py index 6bed89841c..db1bf5b678 100644 --- a/erpnext/accounts/report/tax_detail/tax_detail.py +++ b/erpnext/accounts/report/tax_detail/tax_detail.py @@ -6,6 +6,8 @@ from __future__ import unicode_literals import frappe, json from frappe import _ +# NOTE: Not compatible with the frappe custom report feature of adding arbitrary doctype columns to the report + # field lists in multiple doctypes will be coalesced required_sql_fields = { "GL Entry": ["posting_date", "voucher_type", "voucher_no", "account", "account_currency", "debit", "credit"], @@ -87,7 +89,7 @@ def run_report(report_name, data): new_data += [ {columns[1]['fieldname']: section_name, columns[2]['fieldname']: section_total} ] summary += [ {'label': section_name, 'datatype': 'Currency', 'value': section_total} ] if show_detail: new_data += [ {} ] - return new_data if new_data else data, summary + return new_data or data, summary or None def filter_match(value, string): "Approximation to datatable filters"