-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
f217e5f
to
e57a00e
Compare
e57a00e
to
77191de
Compare
Quality Gate passedIssues Measures |
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. |
Issue FECFILE-1658
APP PR2329