fix - showing price features in distributions seraizlier

This commit is contained in:
2025-12-06 11:17:19 +03:30
parent ce58bbf958
commit 0f711afe66
3 changed files with 8 additions and 4 deletions

View File

@@ -14,7 +14,7 @@
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (env)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

2
.idea/misc.xml generated
View File

@@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.10 (env)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (env)" project-jdk-type="Python SDK" />
</project>

View File

@@ -114,13 +114,17 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
representation['warehouse_balance'] = quotas_stat_amount['inventory_entry_balance']
representation['been_sold'] = quotas_stat_amount['been_sold']
# if quota stat exists and do not have attribute values, check !
attribute_values = quota.attribute_values.filter(org_quota_stat=quota_stat)
representation['attribute_values'] = product_serializers.AttributeValueSerializer(
quota.attribute_values.filter(org_quota_stat=quota_stat),
attribute_values if attribute_values.exists() else quota.attribute_values.filter(org_quota_stat=None),
many=True
).data
# if quota stat exists and do not have broker values, check !
broker_values = quota.broker_values.filter(org_quota_stat=quota_stat)
representation['brokers'] = QuotaBrokerValueSerializer(
quota.broker_values.filter(org_quota_stat=quota_stat),
broker_values if broker_values.exists() else quota.broker_values.filter(org_quota_stat=None),
many=True
).data