fix: use frm instead of cur_frm

This commit is contained in:
Gursheen Anand
2024-02-27 13:05:29 +05:30
parent 20fa3da950
commit ceeb8fc9e5
5 changed files with 9 additions and 9 deletions

View File

@@ -26,14 +26,14 @@ $.extend(erpnext, {
}
},
hide_company: function() {
if(cur_frm?.fields_dict.company) {
hide_company: function(frm) {
if(frm?.fields_dict.company) {
var companies = Object.keys(locals[":Company"] || {});
if(companies.length === 1) {
if(!cur_frm.doc.company) cur_frm.set_value("company", companies[0]);
cur_frm.toggle_display("company", false);
if(!frm.doc.company) frm.set_value("company", companies[0]);
frm.toggle_display("company", false);
} else if(erpnext.last_selected_company) {
if(!cur_frm.doc.company) cur_frm.set_value("company", erpnext.last_selected_company);
if(!frm.doc.company) frm.set_value("company", erpnext.last_selected_company);
}
}
},