Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow optionally send reminder mail for rescheduled interview #1946

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion hrms/hr/doctype/hr_settings/hr_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"send_interview_feedback_reminder",
"feedback_reminder_notification_template",
"column_break_4",
"send_reminder_for_rescheduled_interview",
"rescheduled_interview_reminder_template",
"hiring_sender",
"hiring_sender_email",
"employee_exit_section",
Expand Down Expand Up @@ -316,13 +318,26 @@
"fieldname": "attendance_settings_section",
"fieldtype": "Section Break",
"label": "Attendance Settings"
},
{
"default": "0",
"fieldname": "send_reminder_for_rescheduled_interview",
"fieldtype": "Check",
"label": "Send Reminder For Rescheduled Interview"
},
{
"depends_on": "send_reminder_for_rescheduled_interview",
"fieldname": "rescheduled_interview_reminder_template",
"fieldtype": "Link",
"label": "Rescheduled Interview Reminder Template",
"options": "Email Template"
}
],
"icon": "fa fa-cog",
"idx": 1,
"issingle": 1,
"links": [],
"modified": "2024-06-26 15:20:17.802079",
"modified": "2024-07-04 12:18:37.906016",
"modified_by": "Administrator",
"module": "HR",
"name": "HR Settings",
Expand Down
45 changes: 36 additions & 9 deletions hrms/hr/doctype/interview/interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,47 @@ 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()

reminder_settings = frappe.db.get_value(
"HR Settings",
"HR Settings",
[
"send_reminder_for_rescheduled_interview",
"rescheduled_interview_reminder_template",
"hiring_sender",
],
as_dict=True,
)

if not cint(reminder_settings.send_reminder_for_rescheduled_interview):
return

recipients = get_recipients(self.name)

subject = _("Interview: {0} Rescheduled").format(self.name)
message = _("Your Interview session is rescheduled from {0} {1} - {2} to {3} {4} - {5}").format(
original_date,
original_from_time,
original_to_time,
self.scheduled_on,
self.from_time,
self.to_time,
)

if reminder_settings.rescheduled_interview_reminder_template:
template = frappe.get_doc(
"Email Template", reminder_settings.rescheduled_interview_reminder_template
)
if template:
context = self.as_dict()
response = template.response if not template.use_html else template.response_html
message = frappe.render_template(response, context)
subject = frappe.render_template(template.subject, context)
try:
frappe.sendmail(
sender=reminder_settings.hiring_sender,
recipients=recipients,
subject=_("Interview: {0} Rescheduled").format(self.name),
message=_("Your Interview session is rescheduled from {0} {1} - {2} to {3} {4} - {5}").format(
original_date,
original_from_time,
original_to_time,
self.scheduled_on,
self.from_time,
self.to_time,
),
subject=subject,
message=message,
reference_doctype=self.doctype,
reference_name=self.name,
)
Expand Down
Loading