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:23:45 +05:30
parent 0b5e990751
commit 11ea0b1289
13 changed files with 33 additions and 74 deletions

View File

@@ -145,6 +145,7 @@ $.extend(erpnext.utils, {
},
get_party_name: function(party_type) {
console.log("********");
var dict = {'Customer': 'customer_name', 'Supplier': 'supplier_name', 'Employee': 'employee_name',
'Member': 'member_name'};
return dict[party_type];
@@ -191,6 +192,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",