From b42f972be0ee1a7317887c356519690f0d24cade Mon Sep 17 00:00:00 2001 From: NIYAZ RAZAK <76736615+niyazrazak@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:08:20 +0300 Subject: [PATCH 1/4] chore: interview reschedule email alert based on hr setting --- hrms/hr/doctype/interview/interview.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hrms/hr/doctype/interview/interview.py b/hrms/hr/doctype/interview/interview.py index 2e6aa08146..d4b6f4ca2a 100644 --- a/hrms/hr/doctype/interview/interview.py +++ b/hrms/hr/doctype/interview/interview.py @@ -97,6 +97,16 @@ def reschedule_interview(self, scheduled_on, from_time, to_time): recipients = get_recipients(self.name) + reminder_settings = frappe.db.get_value( + "HR Settings", + "HR Settings", + ["send_interview_reminder"], + as_dict=True, + ) + + if not cint(reminder_settings.send_interview_reminder): + return + try: frappe.sendmail( recipients=recipients, From 76d840d7e389814b46717b82cccabf66bce02115 Mon Sep 17 00:00:00 2001 From: NIYAZ RAZAK <76736615+niyazrazak@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:13:34 +0300 Subject: [PATCH 2/4] chore: alert msg --- hrms/hr/doctype/interview/interview.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hrms/hr/doctype/interview/interview.py b/hrms/hr/doctype/interview/interview.py index d4b6f4ca2a..5046b3df2a 100644 --- a/hrms/hr/doctype/interview/interview.py +++ b/hrms/hr/doctype/interview/interview.py @@ -105,6 +105,7 @@ def reschedule_interview(self, scheduled_on, from_time, to_time): ) if not cint(reminder_settings.send_interview_reminder): + frappe.msgprint(_("Interview Rescheduled successfully"), indicator="green") return try: From 2996e93953c8dcdca23dde051736461b9eeaceda Mon Sep 17 00:00:00 2001 From: NIYAZ RAZAK <76736615+niyazrazak@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:29:56 +0300 Subject: [PATCH 3/4] chore: avoid duplicate error message Co-authored-by: Rucha Mahabal --- hrms/hr/doctype/interview/interview.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hrms/hr/doctype/interview/interview.py b/hrms/hr/doctype/interview/interview.py index 5046b3df2a..f1ad0f4d37 100644 --- a/hrms/hr/doctype/interview/interview.py +++ b/hrms/hr/doctype/interview/interview.py @@ -97,14 +97,8 @@ def reschedule_interview(self, scheduled_on, from_time, to_time): recipients = get_recipients(self.name) - reminder_settings = frappe.db.get_value( - "HR Settings", - "HR Settings", - ["send_interview_reminder"], - as_dict=True, - ) - - if not cint(reminder_settings.send_interview_reminder): + if not cint(frappe.db.get_single_value("HR Settings", "send_interview_reminder")): + return frappe.msgprint(_("Interview Rescheduled successfully"), indicator="green") return From 47e2d975ffa70ef272eea19b2e2325e8f6c34701 Mon Sep 17 00:00:00 2001 From: NIYAZ RAZAK <76736615+niyazrazak@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:33:15 +0300 Subject: [PATCH 4/4] chore: clean code --- hrms/hr/doctype/interview/interview.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hrms/hr/doctype/interview/interview.py b/hrms/hr/doctype/interview/interview.py index f1ad0f4d37..b70b7a6743 100644 --- a/hrms/hr/doctype/interview/interview.py +++ b/hrms/hr/doctype/interview/interview.py @@ -95,13 +95,11 @@ def reschedule_interview(self, scheduled_on, from_time, to_time): self.db_set({"scheduled_on": scheduled_on, "from_time": from_time, "to_time": to_time}) self.notify_update() - recipients = get_recipients(self.name) - + + frappe.msgprint(_("Interview Rescheduled successfully"), indicator="green") if not cint(frappe.db.get_single_value("HR Settings", "send_interview_reminder")): return - frappe.msgprint(_("Interview Rescheduled successfully"), indicator="green") - return - + recipients = get_recipients(self.name) try: frappe.sendmail( recipients=recipients, @@ -124,7 +122,6 @@ def reschedule_interview(self, scheduled_on, from_time, to_time): ) ) - frappe.msgprint(_("Interview Rescheduled successfully"), indicator="green") @frappe.whitelist()