8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

split query into two filters

This commit is contained in:
grisel-davy 2020-10-08 23:24:37 +02:00 committed by Gabriel Detraz
parent 996839ef70
commit 5673b199c5

View file

@ -932,8 +932,8 @@ 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)) | \
~(Q(vente__duration_days_membership__isnull=True) | Q(vente__duration_days_membership=0))
~(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()