Merge pull request #21940 from deepeshgarg007/acc_dim_report_filter

fix: Do not add filters in report on accounting dimension creation if it already exists
This commit is contained in:
Deepesh Garg
2020-05-26 19:30:43 +05:30
committed by GitHub
13 changed files with 32 additions and 74 deletions

View File

@@ -62,7 +62,7 @@ erpnext.financial_statements = {
}
};
function get_filters(){
function get_filters() {
let filters = [
{
"fieldname":"company",
@@ -162,15 +162,6 @@ function get_filters(){
}
]
erpnext.dimension_filters.forEach((dimension) => {
filters.push({
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
});
return filters;
}

View File

@@ -191,6 +191,23 @@ $.extend(erpnext.utils, {
})
},
add_dimensions: function(report_name, index) {
let filters = frappe.query_reports[report_name].filters;
erpnext.dimension_filters.forEach((dimension) => {
let found = filters.some(el => el.fieldname === dimension['fieldname']);
if (!found) {
filters.splice(index, 0 ,{
"fieldname": dimension["fieldname"],
"label": __(dimension["label"]),
"fieldtype": "Link",
"options": dimension["document_type"]
});
}
});
},
make_subscription: function(doctype, docname) {
frappe.call({
method: "frappe.automation.doctype.auto_repeat.auto_repeat.make_auto_repeat",