fix - free product transaction save
This commit is contained in:
@@ -207,14 +207,16 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
||||
id=distribution_id
|
||||
).first() if distribution_id else None
|
||||
|
||||
quota_stat_id = item_data.pop('quota_stat')
|
||||
quota_stat = OrganizationQuotaStats.objects.get(id=quota_stat_id)
|
||||
quota_stat_id = item_data.pop('quota_stat') if 'quota_stat' in item_data.keys() else None
|
||||
quota_stat = OrganizationQuotaStats.objects.get(
|
||||
id=quota_stat_id
|
||||
) if quota_stat_id else None
|
||||
|
||||
# create item for transaction
|
||||
item = warehouse_models.InventoryQuotaSaleItem.objects.create(
|
||||
transaction=transaction,
|
||||
**{'quota_distribution': distribution} if distribution else {},
|
||||
quota_stat=quota_stat,
|
||||
**{'quota_stat': quota_stat, } if quota_stat else {},
|
||||
gov_product=Product.objects.get(
|
||||
id=gov_product
|
||||
) if Product.objects.filter(id=gov_product).exists() else None,
|
||||
|
||||
Reference in New Issue
Block a user