feat: selecting parent_company should disable chart_of_accounts based fields
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 70e047a..dbfbc59 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -16,6 +16,14 @@
filters: {"is_additional_component": 1}
}
});
+
+ frm.set_df_property("create_chart_of_accounts_based_on", "read_only", frm.doc.parent_company ? 1 : 0);
+ frm.set_df_property("existing_company", "read_only", frm.doc.parent_company ? 1 : 0);
+ frm.set_query("parent_company", function() {
+ return {
+ filters: {"is_group": 1}
+ }
+ });
},
company_name: function(frm) {
@@ -28,6 +36,12 @@
}
},
+ parent_company: function(frm) {
+ if(!frm.doc.parent_company) return;
+ frm.set_value("create_chart_of_accounts_based_on", "Existing Company");
+ frm.set_value("existing_company", frm.doc.parent_company);
+ },
+
date_of_commencement: function(frm) {
if(frm.doc.date_of_commencement<frm.doc.date_of_incorporation)
{