When creating a term loan with monthly repayment schedule, the payment_date field in the Repayment Schedule child table shows the same date (the first repayment date) for all payment cycles instead of incrementing monthly.
Steps to Reproduce
- Create a new Loan with
is_term_loan = 1
- Set repayment method to monthly
- Set repayment start date (e.g., 2025-01-13)
- Set loan amount and number of repayments (e.g., 12 months)
- Save the loan
- View the Repayment Schedule
Expected Behavior
Payment 1: January 13, 2025
Payment 2: February 13, 2025
Payment 3: March 13, 2025
Payment 4: April 13, 2025
...
Actual Behavior
Payment 1: January 13, 2025
Payment 2: January 13, 2025
Payment 3: January 13, 2025
Payment 4: January 13, 2025
...
Root Cause
The repayment schedule generation code in lending/loan_management/doctype/loan/loan.py in the make_repayment_schedule() function is not properly incrementing the payment_date variable in the loop that generates schedule entries.
Suggested Fix
The date increment logic needs to use add_months() properly within a loop as an example:
from frappe.utils import add_months
for idx in range(number_of_repayments):
payment_date = add_months(repayment_start_date, idx)
schedule.append({
'payment_date': payment_date,
...
})
Module
Loan Management
Version
- ERPNext Version: v15
- Frappe Lending Version: v15 (a897675)
Installation method
None
Relevant log output / Stack trace / Full Error Message.
Code of Conduct
When creating a term loan with monthly repayment schedule, the
payment_datefield in the Repayment Schedule child table shows the same date (the first repayment date) for all payment cycles instead of incrementing monthly.Steps to Reproduce
is_term_loan = 1Expected Behavior
Actual Behavior
Root Cause
The repayment schedule generation code in
lending/loan_management/doctype/loan/loan.pyin themake_repayment_schedule()function is not properly incrementing the payment_date variable in the loop that generates schedule entries.Suggested Fix
The date increment logic needs to use
add_months()properly within a loop as an example:Module
Loan Management
Version
Installation method
None
Relevant log output / Stack trace / Full Error Message.
Code of Conduct