feat: batch specific email templates

This commit is contained in:
Jannat Patel
2025-02-17 18:17:50 +05:30
parent 492b715ea0
commit fa14ffdcba
3 changed files with 76 additions and 51 deletions

View File

@@ -17,16 +17,17 @@
"start_time",
"end_time",
"timezone",
"section_break_rgfj",
"medium",
"category",
"column_break_flwy",
"seat_count",
"evaluation_end_date",
"section_break_6",
"description",
"column_break_hlqw",
"instructors",
"section_break_rgfj",
"medium",
"category",
"confirmation_email_template",
"column_break_flwy",
"seat_count",
"evaluation_end_date",
"meta_image",
"section_break_khcn",
"batch_details",
@@ -318,6 +319,12 @@
{
"fieldname": "section_break_khcn",
"fieldtype": "Section Break"
},
{
"fieldname": "confirmation_email_template",
"fieldtype": "Link",
"label": "Confirmation Email Template",
"options": "Email Template"
}
],
"index_web_pages_for_search": 1,
@@ -335,7 +342,7 @@
"link_fieldname": "batch_name"
}
],
"modified": "2025-02-12 11:59:35.312487",
"modified": "2025-02-17 17:48:12.949392",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",

View File

@@ -79,13 +79,20 @@ def send_mail(doc):
batch = frappe.db.get_value(
"LMS Batch",
doc.batch,
["name", "title", "start_date", "start_time", "medium"],
[
"name",
"title",
"start_date",
"start_time",
"medium",
"confirmation_email_template",
],
as_dict=1,
)
subject = _("Enrollment Confirmation for {0}").format(batch.title)
template = "batch_confirmation"
custom_template = frappe.db.get_single_value(
custom_template = batch.confirmation_email_template or frappe.db.get_single_value(
"LMS Settings", "batch_confirmation_template"
)