change incentive plans total weight quota with rancher incentive plan - change id to rancher plan and add incentive plan id

This commit is contained in:
2025-09-25 12:16:49 +03:30
parent 10ff4de7ed
commit 8571ef0c68
6 changed files with 102 additions and 33 deletions

View File

@@ -143,12 +143,12 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
# get product by type
gov_product = item_data.pop('gov_product') if 'gov_product' in item_data.keys() else None
free_product = item_data.pop('free_product') if 'free_product' in item_data.keys() else None
distribution = QuotaDistribution.objects.get(id=item_data.pop('quota_distribution'))
# create item for transaction
item = warehouse_models.InventoryQuotaSaleItem.objects.create(
transaction=transaction,
quota_distribution=QuotaDistribution.objects.get(
id=item_data.pop('quota_distribution')
),
quota_distribution=distribution,
gov_product=Product.objects.get(
id=gov_product
) if Product.objects.filter(id=gov_product).exists() else None,