fix: Posting Date check

This commit is contained in:
Deepesh Garg 2021-04-07 09:46:13 +05:30
parent d551940dc5
commit 5af6aea9f9

View File

@ -72,7 +72,7 @@ class LoanRepayment(AccountsController):
def check_future_entries(self):
future_repayment_date = frappe.db.get_value("Loan Repayment", {"posting_date": (">", self.posting_date),
"docstatus": 1}, 'posting_date')
"docstatus": 1, "against_loan": self.against_loan}, 'posting_date')
if future_repayment_date:
frappe.throw("Repayment already made till date {0}".format(getdate(future_repayment_date)))
@ -315,7 +315,10 @@ def create_repayment_entry(loan, applicant, company, posting_date, loan_type,
return lr
def get_accrued_interest_entries(against_loan, posting_date):
def get_accrued_interest_entries(against_loan, posting_date=None):
if not posting_date:
posting_date = getdate()
unpaid_accrued_entries = frappe.db.sql(
"""
SELECT name, posting_date, interest_amount - paid_interest_amount as interest_amount,
@ -343,7 +346,7 @@ def get_amounts(amounts, against_loan, posting_date):
against_loan_doc = frappe.get_doc("Loan", against_loan)
loan_type_details = frappe.get_doc("Loan Type", against_loan_doc.loan_type)
accrued_interest_entries = get_accrued_interest_entries(against_loan_doc.name)
accrued_interest_entries = get_accrued_interest_entries(against_loan_doc.name, posting_date)
pending_accrual_entries = {}