From 17e2d34340451602571d4160f8d050892c24c646 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Mon, 11 Nov 2024 16:13:02 +0530 Subject: [PATCH] fix: Submit Feedback button in interview --- hrms/hr/doctype/interview/interview.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hrms/hr/doctype/interview/interview.js b/hrms/hr/doctype/interview/interview.js index 7586e7fe68..71c7f29f4f 100644 --- a/hrms/hr/doctype/interview/interview.js +++ b/hrms/hr/doctype/interview/interview.js @@ -54,9 +54,22 @@ frappe.ui.form.on("Interview", { ); if (allow_feedback_submission) { - frm.page.set_primary_action(__("Submit Feedback"), () => { - frm.trigger("submit_feedback"); - }); + frappe.db + .get_value( + "Interview Feedback", + { + interview: frm.doc.name, + docstatus: 1, + }, + "name", + ) + .then((feedback) => { + if (!feedback.message || Object.keys(feedback.message).length === 0) { + frm.page.set_primary_action(__("Submit Feedback"), () => { + frm.trigger("submit_feedback"); + }); + } + }); } else { const button = frm.add_custom_button(__("Submit Feedback"), () => { frm.trigger("submit_feedback");