Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: closed status in loan disbursement #222

Merged

Conversation

Nihantra-Patel
Copy link
Member

First, add a status field in the loan disbursement. When the loan repayment schedule is closed, the loan disbursement should also be automatically marked as closed.

@Nihantra-Patel Nihantra-Patel marked this pull request as ready for review December 31, 2024 12:32
@Nihantra-Patel Nihantra-Patel marked this pull request as draft December 31, 2024 13:42
@Nihantra-Patel Nihantra-Patel marked this pull request as ready for review January 1, 2025 04:59

loan_dis = frappe.db.get_all(
"Loan Disbursement",
filters={"status": ["!=", "Closed"]},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have just introduced the status field, whats the point of checking status here?

)
for ld in loan_dis:
if ld.docstatus == 0:
frappe.db.set_value("Loan Disbursement", ld.name, "status", "Draft", update_modified=False)
Copy link
Member

@deepeshgarg007 deepeshgarg007 Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making one single query for every loan will take lot of time, we have 3 statuses to update. Can you do it just 3 update queries?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@deepeshgarg007 deepeshgarg007 merged commit 728cd21 into frappe:poc-staging Jan 1, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants