fix: Default Accounting Dimensions in doctypes
diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json
index 6a4dc5c..0fab74d 100644
--- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json
+++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.json
@@ -9,6 +9,7 @@
"document_type",
"label",
"fieldname",
+ "default_dimension",
"mandatory_for_bs",
"mandatory_for_pl",
"disabled"
@@ -53,9 +54,15 @@
"fieldname": "mandatory_for_pl",
"fieldtype": "Check",
"label": "Mandatory For Profit and Loss Account"
+ },
+ {
+ "fieldname": "default_dimension",
+ "fieldtype": "Dynamic Link",
+ "label": "Default Dimension",
+ "options": "document_type"
}
],
- "modified": "2019-07-14 17:25:01.307948",
+ "modified": "2019-07-14 19:16:25.405924",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounting Dimension",
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 0252f38..1c5e98e 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -69,7 +69,7 @@
return [];
}
let dimensions = await frappe.db.get_list('Accounting Dimension', {
- fields: ['label', 'fieldname', 'document_type'],
+ fields: ['label', 'fieldname', 'document_type', 'default_dimension'],
filters: {
disabled: 0
}
diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js
index 549f95e..4a82edd 100644
--- a/erpnext/public/js/utils/dimension_tree_filter.js
+++ b/erpnext/public/js/utils/dimension_tree_filter.js
@@ -14,6 +14,9 @@
onload: function(frm) {
erpnext.dimension_filters.then((dimensions) => {
dimensions.forEach((dimension) => {
+ if (dimension['default_dimension']) {
+ frm.set_value(dimension['fieldname'], dimension['default_dimension']);
+ }
frappe.model.with_doctype(dimension['document_type'], () => {
if (frappe.meta.has_field(dimension['document_type'], 'is_group')) {
frm.set_query(dimension['fieldname'], {