fix: Check for custom dimensions

This commit is contained in:
Deepesh Garg
2021-01-04 14:23:31 +05:30
parent 377fe373e2
commit f709d57475

View File

@@ -23,6 +23,7 @@ erpnext.accounts.dimensions = {
}, },
setup_filters(frm, doctype) { setup_filters(frm, doctype) {
if (this.accounting_dimensions) {
this.accounting_dimensions.forEach((dimension) => { this.accounting_dimensions.forEach((dimension) => {
frappe.model.with_doctype(dimension['document_type'], () => { frappe.model.with_doctype(dimension['document_type'], () => {
let parent_fields = []; let parent_fields = [];
@@ -39,6 +40,7 @@ erpnext.accounts.dimensions = {
}); });
}); });
}); });
}
}, },
setup_child_filters(frm, doctype, parentfield, dimension) { setup_child_filters(frm, doctype, parentfield, dimension) {
@@ -91,7 +93,7 @@ erpnext.accounts.dimensions = {
}, },
copy_dimension_from_first_row(frm, cdt, cdn, fieldname) { copy_dimension_from_first_row(frm, cdt, cdn, fieldname) {
if (frappe.meta.has_field(frm.doctype, fieldname)) { if (frappe.meta.has_field(frm.doctype, fieldname) && this.accounting_dimensions) {
this.accounting_dimensions.forEach((dimension) => { this.accounting_dimensions.forEach((dimension) => {
let row = frappe.get_doc(cdt, cdn); let row = frappe.get_doc(cdt, cdn);
frm.script_manager.copy_from_first_row(fieldname, row, [dimension['fieldname']]); frm.script_manager.copy_from_first_row(fieldname, row, [dimension['fieldname']]);