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

feature/1658 - Loans, debts, and repayments with future reports can't be deleted. Loans and debts with past reports can't be deleted. #1165

Closed
wants to merge 2 commits into from

Conversation

sasha-dresden
Copy link
Contributor

@sasha-dresden sasha-dresden commented Nov 1, 2024

Issue FECFILE-1658
APP PR2329

…ans and debts with past reports can't be deleted.
# For loan and debts including repayments,
# if there's a following report you can't delete
if (
"loan" in self.transaction_type_identifier.lower()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use something safer here? Perhaps checking schedule_c1_id or schedule_d_id might be sufficient or even maintaining a list of loans/debt and repayments transaction types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Completely reworked this. Now everything is happening inside a trigger and the can_delete property is back to only looking at the blocking_reports field.
I believe my trigger addressed these issues. I used several different ways. Schedule, loan_id, debt_id, although I needed to do a bit of extra work to get the repayments and the receipts.

if len(self.blocking_reports) > 0:
return False
# For loan and debts, if there's a previous report you can't delete
if self.schedule_d or self.schedule_c:
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should use similar logic here to whatever we decide below for determining loan/debt so we don't have inconsistencies.

Copy link

sonarcloud bot commented Nov 8, 2024

@Elaine-Krauss-TCG
Copy link
Contributor

The transactions cannot be deleted, as intended, but I am getting the "Delete" option for the Loan Made transaction. In the API's response containing that transaction, "can_delete" is true, but actually trying to delete it fails because the parent can't be deleted.

@toddlees toddlees closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants