fix - comment quota stat on sale in warehouse signals
This commit is contained in:
@@ -2,7 +2,7 @@ from django.db.models import Sum
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
|
||||
from apps.product.models import QuotaDistribution, OrganizationQuotaStats
|
||||
from apps.product.models import QuotaDistribution
|
||||
from .models import InventoryEntry, InventoryQuotaSaleItem
|
||||
|
||||
|
||||
@@ -69,16 +69,16 @@ def update_distribution_warehouse_sold_and_balance(sender, instance: InventoryQu
|
||||
else:
|
||||
print("quota distribution is null - warehouse app signals")
|
||||
|
||||
|
||||
@receiver(post_save, sender=InventoryQuotaSaleItem)
|
||||
def update_quota_stats_on_sale(sender, instance: InventoryQuotaSaleItem, created, **kwargs):
|
||||
if instance.transaction.transaction_status == 'success':
|
||||
return
|
||||
|
||||
stats = OrganizationQuotaStats.objects.filter(
|
||||
organization=instance.quota_distribution.assigned_organization,
|
||||
quota=instance.quota_distribution.quota
|
||||
).first()
|
||||
|
||||
if stats:
|
||||
stats.update_amounts()
|
||||
# @receiver(post_save, sender=InventoryQuotaSaleItem)
|
||||
# def update_quota_stats_on_sale(sender, instance: InventoryQuotaSaleItem, created, **kwargs):
|
||||
# if instance.transaction.transaction_status == 'success':
|
||||
# return
|
||||
#
|
||||
# stats = OrganizationQuotaStats.objects.filter(
|
||||
# organization=instance.quota_distribution.assigned_organization,
|
||||
# quota=instance.quota_distribution.quota
|
||||
# ).first()
|
||||
#
|
||||
# if stats:
|
||||
# stats.update_amounts()
|
||||
# برای محصولات ازاد چک شود و کنترل
|
||||
|
||||
Reference in New Issue
Block a user