diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js index 7abe4a7aab..8b6de0f517 100644 --- a/erpnext/public/js/utils/dimension_tree_filter.js +++ b/erpnext/public/js/utils/dimension_tree_filter.js @@ -35,11 +35,13 @@ erpnext.doctypes_with_dimensions.forEach((doctype) => { } } - if (frm.doc.items && frm.doc.items.length) { + if (frm.doc.items && frm.doc.items.length && frm.doc.docstatus === 0 + && (!frm.doc.items[0][dimension['fieldname']])) { frm.doc.items[0][dimension['fieldname']] = erpnext.default_dimensions[frm.doc.company][dimension['document_type']]; } - if (frm.doc.accounts && frm.doc.accounts.length) { + if (frm.doc.accounts && frm.doc.accounts.length && frm.doc.docstatus === 0 + && (!frm.doc.items[0][dimension['fieldname']])) { frm.doc.accounts[0][dimension['fieldname']] = erpnext.default_dimensions[frm.doc.company][dimension['document_type']]; } }