fix: minor bugs and improvements

This commit is contained in:
casesolved-co-uk 2021-03-24 04:01:18 +00:00
parent 8e413651c2
commit 5d9217ab29
2 changed files with 13 additions and 13 deletions

View File

@ -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(`<div class="col-md-12">${help}</div>`);
}
}

View File

@ -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"