fix: chart of accounts field toggling improv
This commit is contained in:
parent
f71cb8dc6d
commit
cc65447e62
@ -17,8 +17,6 @@ frappe.ui.form.on("Company", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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() {
|
frm.set_query("parent_company", function() {
|
||||||
return {
|
return {
|
||||||
filters: {"is_group": 1}
|
filters: {"is_group": 1}
|
||||||
@ -37,9 +35,10 @@ frappe.ui.form.on("Company", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
parent_company: function(frm) {
|
parent_company: function(frm) {
|
||||||
if(!frm.doc.parent_company) return;
|
var bool = frm.doc.parent_company ? true : false;
|
||||||
frm.set_value("create_chart_of_accounts_based_on", "Existing Company");
|
frm.set_value('create_chart_of_accounts_based_on', bool ? "Existing Company" : "");
|
||||||
frm.set_value("existing_company", frm.doc.parent_company);
|
frm.set_value('existing_company', bool ? frm.doc.parent_company : "");
|
||||||
|
disbale_coa_fields(frm, bool);
|
||||||
},
|
},
|
||||||
|
|
||||||
date_of_commencement: function(frm) {
|
date_of_commencement: function(frm) {
|
||||||
@ -54,8 +53,9 @@ frappe.ui.form.on("Company", {
|
|||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
if(!frm.doc.__islocal) {
|
if(!frm.doc.__islocal) {
|
||||||
frm.set_df_property("abbr", "read_only", 1);
|
frm.doc.abbr && frm.set_df_property("abbr", "read_only", 1);
|
||||||
frm.set_df_property("parent_company", "read_only", 1);
|
frm.set_df_property("parent_company", "read_only", 1);
|
||||||
|
disbale_coa_fields(frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.toggle_display('address_html', !frm.doc.__islocal);
|
frm.toggle_display('address_html', !frm.doc.__islocal);
|
||||||
@ -271,3 +271,9 @@ erpnext.company.set_custom_query = function(frm, v) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var disbale_coa_fields = function(frm, bool=true) {
|
||||||
|
frm.set_df_property("create_chart_of_accounts_based_on", "read_only", bool);
|
||||||
|
frm.set_df_property("chart_of_accounts", "read_only", bool);
|
||||||
|
frm.set_df_property("existing_company", "read_only", bool);
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user