fix: Default Accounting Dimensions in doctypes
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"document_type",
|
"document_type",
|
||||||
"label",
|
"label",
|
||||||
"fieldname",
|
"fieldname",
|
||||||
|
"default_dimension",
|
||||||
"mandatory_for_bs",
|
"mandatory_for_bs",
|
||||||
"mandatory_for_pl",
|
"mandatory_for_pl",
|
||||||
"disabled"
|
"disabled"
|
||||||
@@ -53,9 +54,15 @@
|
|||||||
"fieldname": "mandatory_for_pl",
|
"fieldname": "mandatory_for_pl",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Mandatory For Profit and Loss Account"
|
"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",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Accounting Dimension",
|
"name": "Accounting Dimension",
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ $.extend(erpnext, {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
let dimensions = await frappe.db.get_list('Accounting Dimension', {
|
let dimensions = await frappe.db.get_list('Accounting Dimension', {
|
||||||
fields: ['label', 'fieldname', 'document_type'],
|
fields: ['label', 'fieldname', 'document_type', 'default_dimension'],
|
||||||
filters: {
|
filters: {
|
||||||
disabled: 0
|
disabled: 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ erpnext.doctypes_with_dimensions.forEach((doctype) => {
|
|||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
erpnext.dimension_filters.then((dimensions) => {
|
erpnext.dimension_filters.then((dimensions) => {
|
||||||
dimensions.forEach((dimension) => {
|
dimensions.forEach((dimension) => {
|
||||||
|
if (dimension['default_dimension']) {
|
||||||
|
frm.set_value(dimension['fieldname'], dimension['default_dimension']);
|
||||||
|
}
|
||||||
frappe.model.with_doctype(dimension['document_type'], () => {
|
frappe.model.with_doctype(dimension['document_type'], () => {
|
||||||
if (frappe.meta.has_field(dimension['document_type'], 'is_group')) {
|
if (frappe.meta.has_field(dimension['document_type'], 'is_group')) {
|
||||||
frm.set_query(dimension['fieldname'], {
|
frm.set_query(dimension['fieldname'], {
|
||||||
|
|||||||
Reference in New Issue
Block a user