[hotfix] fixed Permissions Error while fetching allow_stale field value from Accounts Settings (#11182)

* [hotfix] fixed Permissions Error while fetching allow_stale field value from Accounts Settings

* [minor] renamed the allow_stale_rate method to stale_rate_allowed
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index fc9fc97..17ac1f7 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -405,11 +405,7 @@
 		}
 
 		// Make read only if Accounts Settings doesn't allow stale rates
-		frappe.model.get_value("Accounts Settings", null, "allow_stale",
-			function(d){
-				frm.set_df_property("source_exchange_rate", "read_only", cint(d.allow_stale) ? 0 : 1);
-			}
-		);
+		frm.set_df_property("source_exchange_rate", "read_only", erpnext.stale_rate_allowed());
 	},
 
 	target_exchange_rate: function(frm) {
@@ -430,11 +426,7 @@
 		frm.set_paid_amount_based_on_received_amount = false;
 
 		// Make read only if Accounts Settings doesn't allow stale rates
-		frappe.model.get_value("Accounts Settings", null, "allow_stale",
-			function(d){
-				frm.set_df_property("target_exchange_rate", "read_only", cint(d.allow_stale) ? 0 : 1);
-			}
-		);
+		frm.set_df_property("target_exchange_rate", "read_only", erpnext.stale_rate_allowed());
 	},
 
 	paid_amount: function(frm) {
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 5b647f8..41fdc6e 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -542,11 +542,7 @@
 
 		}
 		// Make read only if Accounts Settings doesn't allow stale rates
-		frappe.model.get_value("Accounts Settings", null, "allow_stale",
-			function(d){
-				me.set_df_property("conversion_rate", "read_only", cint(d.allow_stale) ? 0 : 1);
-			}
-		);
+		this.frm.set_df_property("conversion_rate", "read_only", erpnext.stale_rate_allowed());
 	},
 
 	set_actual_charges_based_on_currency: function() {
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 721f216..efb04d1 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -37,6 +37,10 @@
 		}
 	},
 
+	stale_rate_allowed: () => {
+		return cint(frappe.boot.sysdefaults.allow_stale) || 1;
+	},
+
 	setup_serial_no: function() {
 		var grid_row = cur_frm.open_grid_row();
 		if(!grid_row || !grid_row.grid_form.fields_dict.serial_no ||
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 3164306..2080224 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -19,6 +19,8 @@
 			'territory')
 		bootinfo.sysdefaults.customer_group = frappe.db.get_single_value('Selling Settings',
 			'customer_group')
+		bootinfo.sysdefaults.allow_stale = frappe.db.get_single_value('Accounts Settings',
+			'allow_stale') or 1
 
 		bootinfo.notification_settings = frappe.get_doc("Notification Control",
 			"Notification Control")