From 6a1e31c63334b7356647d24da84435b25da50bbe Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 20 May 2021 23:16:22 +0530 Subject: [PATCH] fix: Check if user can rread before querying Support Settings --- erpnext/support/doctype/issue/issue.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js index ecc9fcfe82..99a4e04b7d 100644 --- a/erpnext/support/doctype/issue/issue.js +++ b/erpnext/support/doctype/issue/issue.js @@ -9,15 +9,17 @@ frappe.ui.form.on("Issue", { }; }); - frappe.db.get_value("Support Settings", {name: "Support Settings"}, - ["allow_resetting_service_level_agreement", "track_service_level_agreement"], (r) => { - if (r && r.track_service_level_agreement == "0") { - frm.set_df_property("service_level_section", "hidden", 1); - } - if (r && r.allow_resetting_service_level_agreement == "0") { - frm.set_df_property("reset_service_level_agreement", "hidden", 1); - } - }); + if (frappe.model.can_read("Support Settings")) { + frappe.db.get_value("Support Settings", {name: "Support Settings"}, + ["allow_resetting_service_level_agreement", "track_service_level_agreement"], (r) => { + if (r && r.track_service_level_agreement == "0") { + frm.set_df_property("service_level_section", "hidden", 1); + } + if (r && r.allow_resetting_service_level_agreement == "0") { + frm.set_df_property("reset_service_level_agreement", "hidden", 1); + } + }); + } if (frm.doc.service_level_agreement) { frappe.call({