Kaynağa Gözat

Fix partner product filter queryset in order to allow partner users access their products with variations.

master
Alexander Gaevsky 4 yıl önce
ebeveyn
işleme
087df7caab
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6
    1
      src/oscar/apps/dashboard/catalogue/mixins.py

+ 6
- 1
src/oscar/apps/dashboard/catalogue/mixins.py Dosyayı Görüntüle

@@ -1,3 +1,6 @@
1
+from django.db.models import Q
2
+
3
+
1 4
 class PartnerProductFilterMixin:
2 5
     def filter_queryset(self, queryset):
3 6
         """
@@ -10,4 +13,6 @@ class PartnerProductFilterMixin:
10 13
         if user.is_staff:
11 14
             return queryset
12 15
 
13
-        return queryset.filter(stockrecords__partner__users__pk=user.pk).distinct()
16
+        return queryset.filter(
17
+            Q(children__stockrecords__partner__users__pk=user.pk) | Q(stockrecords__partner__users__pk=user.pk)
18
+        ).distinct()

Loading…
İptal
Kaydet