From cd1bdc0883c5063f327271dcd234ce51ce5a95a6 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:50:06 +0530 Subject: [PATCH] fix: rendering the email template subject in leave notification (backport #2027) (#2047) (cherry picked from commit 816a50ef6a9cc7b5e2de9158d12451b335833e33) Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com> --- hrms/hr/doctype/leave_application/leave_application.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/leave_application/leave_application.py b/hrms/hr/doctype/leave_application/leave_application.py index e314ded633..9331b47e7f 100755 --- a/hrms/hr/doctype/leave_application/leave_application.py +++ b/hrms/hr/doctype/leave_application/leave_application.py @@ -597,6 +597,7 @@ def notify_employee(self): frappe.msgprint(_("Please set default template for Leave Status Notification in HR Settings.")) return email_template = frappe.get_doc("Email Template", template) + subject = frappe.render_template(email_template.subject, args) message = frappe.render_template(email_template.response_, args) self.notify( @@ -605,7 +606,7 @@ def notify_employee(self): "message": message, "message_to": employee_email, # for email - "subject": email_template.subject, + "subject": subject, "notify": "employee", } ) @@ -622,6 +623,7 @@ def notify_leave_approver(self): ) return email_template = frappe.get_doc("Email Template", template) + subject = frappe.render_template(email_template.subject, args) message = frappe.render_template(email_template.response_, args) self.notify( @@ -630,7 +632,7 @@ def notify_leave_approver(self): "message": message, "message_to": self.leave_approver, # for email - "subject": email_template.subject, + "subject": subject, } )