fix - set pre sale/free sale in property & add to quota model
This commit is contained in:
@@ -77,7 +77,7 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
||||
|
||||
return data
|
||||
|
||||
def to_representation(self, instance):
|
||||
def to_representation(self, instance: product_models.QuotaDistribution):
|
||||
""" Custom output of serializer """
|
||||
|
||||
representation = super().to_representation(instance)
|
||||
@@ -86,6 +86,9 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
||||
rancher = self.context['rancher']
|
||||
device = self.context['device']
|
||||
|
||||
representation['free_sale'] = instance.free_sale
|
||||
representation['pre_sale'] = instance.pre_sale
|
||||
|
||||
if instance.quota:
|
||||
representation['quota'] = {
|
||||
'quota_identity': instance.quota.quota_id,
|
||||
|
||||
@@ -94,7 +94,7 @@ class QuotaDistributionViewSet(viewsets.ModelViewSet, DynamicSearchMixin, POSDev
|
||||
Q(assigned_organization=organization),
|
||||
Q(quota__is_closed=False),
|
||||
(
|
||||
Q(pre_sale=True) | Q(free_sale=True) | Q(warehouse_entry__gt=0)
|
||||
Q(quota__pre_sale=True) | Q(quota__free_sale=True) | Q(warehouse_entry__gt=0)
|
||||
)
|
||||
).order_by('-create_date')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user