From 53d943ec7044dff444dccf7d8d30f97c5b8075b7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sat, 24 Feb 2024 17:04:36 +0530 Subject: [PATCH] fix: Cannot read properties of undefined (backport #40081) (#40083) fix: Cannot read properties of undefined (cherry picked from commit 44ed52c5cfa6a2432769bbb6f3c352aa81025de2) Co-authored-by: Rohit Waghchaure --- erpnext/public/js/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index de46271e474..456a215f10b 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -40,7 +40,10 @@ $.extend(erpnext, { is_perpetual_inventory_enabled: function(company) { if(company) { - return frappe.get_doc(":Company", company).enable_perpetual_inventory + let company_local = locals[":Company"] && locals[":Company"][company]; + if(company_local) { + return cint(company_local.enable_perpetual_inventory); + } } },