fix: Check if user can rread before querying Support Settings

This commit is contained in:
Deepesh Garg 2021-05-20 23:16:22 +05:30
parent 9de1a45185
commit 6a1e31c633

View File

@ -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({