fix - warehouse of quota stat in pos deviec complete - v2
This commit is contained in:
@@ -201,11 +201,13 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
||||
gov_product = item_data.pop('gov_product', None)
|
||||
free_product = item_data.pop('free_product', None)
|
||||
|
||||
distribution_id = item_data.pop('quota_distribution')
|
||||
distribution = QuotaDistribution.objects.filter(
|
||||
id=item_data.pop('quota_distribution')
|
||||
id=distribution_id
|
||||
).first() if 'quota_distribution' in item_data.keys() else None
|
||||
|
||||
quota_stat = OrganizationQuotaStats.objects.get(id=item_data.pop('quota_stat'))
|
||||
quota_stat_id = item_data.pop('quota_stat')
|
||||
quota_stat = OrganizationQuotaStats.objects.get(id=quota_stat_id)
|
||||
|
||||
# create item for transaction
|
||||
item = warehouse_models.InventoryQuotaSaleItem.objects.create(
|
||||
@@ -223,7 +225,7 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
|
||||
total_price += item.total_price
|
||||
|
||||
# IF WE DO NOT HAVE DISTRIBUTION, THEN IT IS A FREE PRODUCT TRANSACTION
|
||||
if 'quota_distribution' and 'quota_stat' in item_data.keys():
|
||||
if distribution_id and quota_stat_id in item_data.keys():
|
||||
# create extra sale for distribution
|
||||
create_extra_sale(transaction=transaction, sale_item=item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user