fix: use frm instead of cur_frm

(cherry picked from commit ceeb8fc9e5)
This commit is contained in:
Gursheen Anand
2024-02-27 13:05:29 +05:30
committed by Mergify
parent 6b5e1cfeb7
commit 341f9030f5
5 changed files with 9 additions and 9 deletions

View File

@@ -397,7 +397,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
refresh() {
erpnext.toggle_naming_series();
erpnext.hide_company();
erpnext.hide_company(this.frm);
this.set_dynamic_labels();
this.setup_sms();
this.setup_quality_inspection();

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);
}
}
},