Skip to content

Loan Repayment Schedule payment_date field shows same date for all monthly cycles #1055

@eleben

Description

@eleben

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

  1. Create a new Loan with is_term_loan = 1
  2. Set repayment method to monthly
  3. Set repayment start date (e.g., 2025-01-13)
  4. Set loan amount and number of repayments (e.g., 12 months)
  5. Save the loan
  6. 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

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions