feat: settings for payment reminders

This commit is contained in:
Jannat Patel
2026-03-10 18:44:28 +05:30
parent c583ad72d1
commit d68a362115
3 changed files with 72 additions and 11 deletions

View File

@@ -331,29 +331,62 @@ const tabsStructure = computed(() => {
doctype: 'Currency',
},
{
label: 'Payment Gateway',
name: 'payment_gateway',
type: 'Link',
doctype: 'Payment Gateway',
label: 'Show USD equivalent amount',
name: 'show_usd_equivalent',
type: 'checkbox',
description:
'If enabled, it shows the USD equivalent amount for all transactions based on the current exchange rate.',
},
{
label: 'Apply rounding on equivalent',
name: 'apply_rounding',
type: 'checkbox',
description:
'If enabled, it applies rounding on the USD equivalent amount.',
},
],
},
{
fields: [
{
label: 'Payment Gateway',
name: 'payment_gateway',
type: 'Link',
doctype: 'Payment Gateway',
},
{
label: 'Apply GST for India',
name: 'apply_gst',
type: 'checkbox',
description:
'If enabled, GST will be applied to the price for students from India.',
},
],
},
],
},
{
label: 'Payment Reminders',
columns: [
{
fields: [
{
label: 'Show USD equivalent amount',
name: 'show_usd_equivalent',
label: 'Send payment reminders for batch',
name: 'send_payment_reminders_for_batch',
type: 'checkbox',
description:
'If enabled, it sends payment reminders to students who left the payment incomplete for a batch.',
},
],
},
{
fields: [
{
label: 'Apply rounding on equivalent',
name: 'apply_rounding',
label: 'Send payment reminders for course',
name: 'send_payment_reminders_for_course',
type: 'checkbox',
description:
'If enabled, it sends payment reminders to students who left the payment incomplete for a course.',
},
],
},

View File

@@ -27,7 +27,7 @@ def send_payment_reminder():
{
"payment_received": 0,
"creation": [">", add_days(nowdate(), -1)],
"payment_for_document_type": "LMS Batch",
"payment_for_document_type": ["in", allowed_payment_types()],
},
[
"name",
@@ -48,6 +48,20 @@ def send_payment_reminder():
send_mail(payment)
def allowed_payment_types():
send_batch_reminders = frappe.db.get_single_value("LMS Settings", "send_payment_reminders_for_batch")
send_course_reminders = frappe.db.get_single_value("LMS Settings", "send_payment_reminders_for_course")
allowed_types = []
if send_batch_reminders:
allowed_types.append("LMS Batch")
if send_course_reminders:
allowed_types.append("LMS Course")
return allowed_types
def has_paid_later(payment):
return frappe.db.exists(
"LMS Payment",

View File

@@ -62,6 +62,8 @@
"apply_gst",
"show_usd_equivalent",
"apply_rounding",
"send_payment_reminders_for_batch",
"send_payment_reminders_for_course",
"no_payments_app",
"payments_app_is_not_installed",
"email_templates_tab",
@@ -492,14 +494,26 @@
"fieldtype": "Check",
"label": "Demo Data Present",
"read_only": 1
},
{
"default": "0",
"fieldname": "send_payment_reminders_for_batch",
"fieldtype": "Check",
"label": "Send Payment Reminders for Batch"
},
{
"default": "0",
"fieldname": "send_payment_reminders_for_course",
"fieldtype": "Check",
"label": "Send Payment Reminders for Course"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2026-03-05 13:57:56.303744",
"modified_by": "Administrator",
"modified": "2026-03-10 18:18:51.733955",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Settings",
"owner": "Administrator",