Merge pull request #23301 from deepeshgarg007/closed_loan_amount

fix: Amount for closed loans
This commit is contained in:
Deepesh Garg 2020-09-08 21:32:54 +05:30 committed by GitHub
commit dc84633860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -317,6 +317,11 @@ class TestLoan(unittest.TestCase):
self.assertEqual(loan.status, 'Closed')
self.assertEquals(sum(pledged_qty.values()), 0)
amounts = amounts = calculate_amounts(loan.name, add_days(last_date, 6), "Regular Repayment")
self.assertEqual(amounts['pending_principal_amount'], 0)
self.assertEqual(amounts['payable_principal_amount'], 0)
self.assertEqual(amounts['interest_amount'], 0)
def test_disbursal_check_with_shortfall(self):
pledges = [{
"loan_security": "Test Security 2",

View File

@ -327,7 +327,7 @@ def get_amounts(amounts, against_loan, posting_date, payment_type):
if not final_due_date:
final_due_date = add_days(due_date, loan_type_details.grace_period_in_days)
if against_loan_doc.status in ('Disbursed', 'Loan Closure Requested'):
if against_loan_doc.status in ('Disbursed', 'Loan Closure Requested', 'Closed'):
pending_principal_amount = against_loan_doc.total_payment - against_loan_doc.total_principal_paid - against_loan_doc.total_interest_payable
else:
pending_principal_amount = against_loan_doc.disbursed_amount