From 108154d6ce4cec75c8c1a6f25bcbd28076046636 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 13 Oct 2020 22:50:44 +0200 Subject: [PATCH] Fix query test for set_active function --- users/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/users/models.py b/users/models.py index f35149dc..57195536 100755 --- a/users/models.py +++ b/users/models.py @@ -931,9 +931,9 @@ class User( """ if self.state == self.STATE_NOT_YET_ACTIVE: - if self.facture_set.filter(valid=True).filter( - ~(Q(vente__duration_membership__isnull=True) | Q(vente__duration_membership=0)))\ - .filter(~(Q(vente__duration_days_membership__isnull=True) | Q(vente__duration_days_membership=0)) + if not self.facture_set.filter(valid=True).filter( + (Q(vente__duration_membership__isnull=True) | Q(vente__duration_membership=0))\ + ).filter(Q(vente__duration_days_membership__isnull=True) | Q(vente__duration_days_membership=0) ).exists() or OptionalUser.get_cached_value("all_users_active"): self.state = self.STATE_ACTIVE self.save()