fix - change base of pre sale / extra sale on quota stat & total purchase of rancher in Quota usage calculation

This commit is contained in:
2025-11-26 15:50:35 +03:30
parent 817f26519d
commit 65bdb539bc
7 changed files with 51 additions and 26 deletions

View File

@@ -22,6 +22,7 @@ from apps.product.services.services import (
from apps.warehouse import models as warehouse_models
from apps.warehouse.exceptions import WareHouseException
from apps.warehouse.services.quota_usage_services import QuotaUsageService
from apps.warehouse.services.services import create_extra_sale, create_pre_sale
class InventoryEntrySerializer(serializers.ModelSerializer):
@@ -223,11 +224,11 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
# IF WE DO NOT HAVE DISTRIBUTION, THEN IT IS A FREE PRODUCT TRANSACTION
if 'quota_distribution' and 'quota_stat' in item_data.keys():
# # create extra sale for distribution
# create_extra_sale(transaction=transaction, sale_item=item)
#
# # create pre sale for distribution
# create_pre_sale(transaction=transaction, sale_item=item)
# create extra sale for distribution
create_extra_sale(transaction=transaction, sale_item=item)
# create pre sale for distribution
create_pre_sale(transaction=transaction, sale_item=item)
# calculate quota usage of rancher
QuotaUsageService.allocate_usage(