import - rancher dashboard by quota
This commit is contained in:
@@ -14,6 +14,7 @@ from apps.pos_device.mixins.pos_device_mixin import POSDeviceMixin
|
||||
from apps.product import models as product_models
|
||||
from apps.product.models import OrganizationQuotaStats
|
||||
from apps.product.pos.api.v1.serializers import quota_serializers
|
||||
from apps.warehouse.services.services import can_buy_from_inventory
|
||||
|
||||
|
||||
def trash(queryset, pk): # noqa
|
||||
@@ -232,15 +233,13 @@ class OrganizationQuotaStatsViewSet(viewsets.ModelViewSet, DynamicSearchMixin, P
|
||||
Q(quota__pre_sale=True) | Q(quota__free_sale=True) | Q(inventory_received__gt=0)
|
||||
)
|
||||
).order_by('-create_date')
|
||||
print(quotas)
|
||||
# check quota distributions for rancher
|
||||
# available_distributions = [
|
||||
# distribution for distribution in distributions if (
|
||||
# can_buy_from_inventory(rancher.first(), distribution=distribution) & rancher.exists()
|
||||
# )
|
||||
# ]
|
||||
|
||||
available_distributions = quotas
|
||||
# check quota distributions for rancher
|
||||
available_distributions = [
|
||||
stat for stat in quotas if (
|
||||
can_buy_from_inventory(rancher.first(), quota_stat=stat) & rancher.exists()
|
||||
)
|
||||
]
|
||||
|
||||
# paginate & response
|
||||
page = self.paginate_queryset(available_distributions) # noqa
|
||||
|
||||
Reference in New Issue
Block a user