Simplification

* simplifies fetching of intervention's deductions
This commit is contained in:
mpeltriaux 2023-03-30 15:11:19 +02:00
parent 24a9a7d695
commit 8e89beaf88

View File

@ -312,9 +312,7 @@ class Intervention(BaseObject,
super().mark_as_deleted(user, send_mail) super().mark_as_deleted(user, send_mail)
# Remove pending deductions to free booked capacities # Remove pending deductions to free booked capacities
deductions = EcoAccountDeduction.objects.filter( deductions = self.deductions.all()
intervention=self
)
# Remove one by one instead of bulk to trigger EcoAccountDeduction custom delete() logic # Remove one by one instead of bulk to trigger EcoAccountDeduction custom delete() logic
for deduction in deductions: for deduction in deductions:
deduction.delete() deduction.delete()