mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
fix: minor bugs and improvements
This commit is contained in:
@@ -81,7 +81,6 @@ erpnext.TaxDetail = class TaxDetail {
|
|||||||
}
|
}
|
||||||
show_footer_message() {
|
show_footer_message() {
|
||||||
// The last thing to run after datatable_render in refresh()
|
// The last thing to run after datatable_render in refresh()
|
||||||
console.log('show_footer_message');
|
|
||||||
this.super.show_footer_message.apply(this.qr);
|
this.super.show_footer_message.apply(this.qr);
|
||||||
if (this.qr.report_name !== 'Tax Detail') {
|
if (this.qr.report_name !== 'Tax Detail') {
|
||||||
this.set_value_options();
|
this.set_value_options();
|
||||||
@@ -97,7 +96,6 @@ erpnext.TaxDetail = class TaxDetail {
|
|||||||
// Infrequent report build (onload), load filters & data
|
// Infrequent report build (onload), load filters & data
|
||||||
// super function runs a refresh() serially
|
// super function runs a refresh() serially
|
||||||
// already run within frappe.run_serially
|
// already run within frappe.run_serially
|
||||||
console.log('refresh_report');
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.super.refresh_report.apply(this.qr);
|
this.super.refresh_report.apply(this.qr);
|
||||||
if (this.qr.report_name !== 'Tax Detail') {
|
if (this.qr.report_name !== 'Tax Detail') {
|
||||||
@@ -115,21 +113,23 @@ erpnext.TaxDetail = class TaxDetail {
|
|||||||
load_report() {
|
load_report() {
|
||||||
// One-off report build like titles, menu, etc
|
// One-off report build like titles, menu, etc
|
||||||
// Run when this object is created which happens in qr.load_report
|
// Run when this object is created which happens in qr.load_report
|
||||||
console.log('load_report');
|
|
||||||
this.qr.menu_items = this.get_menu_items();
|
this.qr.menu_items = this.get_menu_items();
|
||||||
}
|
}
|
||||||
get_menu_items() {
|
get_menu_items() {
|
||||||
// Replace save button
|
// Replace Save, remove Add Column
|
||||||
let new_items = [];
|
let new_items = [];
|
||||||
const label = __('Save');
|
const save = __('Save');
|
||||||
|
const addColumn = __('Add Column');
|
||||||
|
|
||||||
for (let item of this.qr.menu_items) {
|
for (let item of this.qr.menu_items) {
|
||||||
if (item.label === label) {
|
if (item.label === save) {
|
||||||
new_items.push({
|
new_items.push({
|
||||||
label: label,
|
label: save,
|
||||||
action: this.save_report,
|
action: () => this.save_report(),
|
||||||
standard: false
|
standard: false
|
||||||
});
|
});
|
||||||
|
} else if (item.label === addColumn) {
|
||||||
|
// Don't add
|
||||||
} else {
|
} else {
|
||||||
new_items.push(item);
|
new_items.push(item);
|
||||||
}
|
}
|
||||||
@@ -279,9 +279,6 @@ erpnext.TaxDetail = class TaxDetail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
create_controls() {
|
create_controls() {
|
||||||
if (this.controls) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let controls = {};
|
let controls = {};
|
||||||
// SELECT in data.js
|
// SELECT in data.js
|
||||||
controls['section_name'] = this.qr.page.add_field({
|
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.
|
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.
|
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
|
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>`);
|
this.qr.$report_footer.append(`<div class="col-md-12">${help}</div>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ from __future__ import unicode_literals
|
|||||||
import frappe, json
|
import frappe, json
|
||||||
from frappe import _
|
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
|
# field lists in multiple doctypes will be coalesced
|
||||||
required_sql_fields = {
|
required_sql_fields = {
|
||||||
"GL Entry": ["posting_date", "voucher_type", "voucher_no", "account", "account_currency", "debit", "credit"],
|
"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} ]
|
new_data += [ {columns[1]['fieldname']: section_name, columns[2]['fieldname']: section_total} ]
|
||||||
summary += [ {'label': section_name, 'datatype': 'Currency', 'value': section_total} ]
|
summary += [ {'label': section_name, 'datatype': 'Currency', 'value': section_total} ]
|
||||||
if show_detail: new_data += [ {} ]
|
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):
|
def filter_match(value, string):
|
||||||
"Approximation to datatable filters"
|
"Approximation to datatable filters"
|
||||||
|
|||||||
Reference in New Issue
Block a user