From 8e89beaf8807aa0b2241e037d96ff41fedbb75f2 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Thu, 30 Mar 2023 15:11:19 +0200 Subject: [PATCH] Simplification * simplifies fetching of intervention's deductions --- intervention/models/intervention.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/intervention/models/intervention.py b/intervention/models/intervention.py index e226b8e9..face187f 100644 --- a/intervention/models/intervention.py +++ b/intervention/models/intervention.py @@ -312,9 +312,7 @@ class Intervention(BaseObject, super().mark_as_deleted(user, send_mail) # Remove pending deductions to free booked capacities - deductions = EcoAccountDeduction.objects.filter( - intervention=self - ) + deductions = self.deductions.all() # Remove one by one instead of bulk to trigger EcoAccountDeduction custom delete() logic for deduction in deductions: deduction.delete()