mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-21 00:01:29 +02:00
fix(transactions): duplicate totals when account is shared with owner or owner-less and shared
#247
This commit is contained in:
@@ -118,13 +118,20 @@ class SoftDeleteManager(models.Manager):
|
|||||||
qs = SoftDeleteQuerySet(self.model, using=self._db)
|
qs = SoftDeleteQuerySet(self.model, using=self._db)
|
||||||
user = get_current_user()
|
user = get_current_user()
|
||||||
if user and not user.is_anonymous:
|
if user and not user.is_anonymous:
|
||||||
return qs.filter(
|
account_ids = (
|
||||||
Q(account__visibility="public")
|
qs.filter(
|
||||||
| Q(account__owner=user)
|
Q(account__visibility="public")
|
||||||
| Q(account__shared_with=user)
|
| Q(account__owner=user)
|
||||||
| Q(account__visibility="private", account__owner=None),
|
| Q(account__shared_with=user)
|
||||||
deleted=False,
|
| Q(account__visibility="private", account__owner=None),
|
||||||
).distinct()
|
deleted=False,
|
||||||
|
)
|
||||||
|
.values_list("account__id", flat=True)
|
||||||
|
.distinct()
|
||||||
|
)
|
||||||
|
|
||||||
|
return qs.filter(account_id__in=account_ids, deleted=False)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return qs.filter(
|
return qs.filter(
|
||||||
deleted=False,
|
deleted=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user