Skip to content

Commit

Permalink
fix: use frm instead of cur_frm
Browse files Browse the repository at this point in the history
(cherry picked from commit ceeb8fc)
  • Loading branch information
GursheenK authored and mergify[bot] committed Feb 27, 2024
1 parent 6b5e1cf commit 341f903
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ frappe.ui.form.on('Payment Entry', {
},

refresh: function(frm) {
erpnext.hide_company();
erpnext.hide_company(frm);
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
frm.events.show_general_ledger(frm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ frappe.ui.form.on('Blanket Order', {
},

refresh: function(frm) {
erpnext.hide_company();
erpnext.hide_company(frm);
if (frm.doc.customer && frm.doc.docstatus === 1 && frm.doc.to_date > frappe.datetime.get_today()) {
frm.add_custom_button(__("Sales Order"), function() {
frappe.model.open_mapped_doc({
Expand Down
2 changes: 1 addition & 1 deletion erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions erpnext/public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion erpnext/stock/doctype/stock_entry/stock_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle
if (this.frm.doc.docstatus===1 && erpnext.is_perpetual_inventory_enabled(this.frm.doc.company)) {
this.show_general_ledger();
}
erpnext.hide_company();
erpnext.hide_company(this.frm);
erpnext.utils.add_item(this.frm);
}

Expand Down

0 comments on commit 341f903

Please sign in to comment.