organization limit for quota - get org childs
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from django.db.models import Sum
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
from .models import QuotaDistribution, Quota
|
||||
from .models import QuotaDistribution, Quota, Product
|
||||
from apps.warehouse.models import InventoryQuotaSaleTransaction
|
||||
|
||||
|
||||
def recalculate_remaining_amount(quota):
|
||||
@@ -18,3 +19,18 @@ def recalculate_remaining_amount(quota):
|
||||
@receiver(post_delete, sender=QuotaDistribution)
|
||||
def update_quota_remaining(sender, instance, **kwargs):
|
||||
recalculate_remaining_amount(instance.quota)
|
||||
|
||||
|
||||
def update_product_stats(instance: Product):
|
||||
pass
|
||||
|
||||
|
||||
def update_quota_stats(instance: Quota):
|
||||
pass
|
||||
|
||||
|
||||
@receiver([post_save, post_delete], sender=QuotaDistribution)
|
||||
@receiver([post_save, post_delete], sender=InventoryQuotaSaleTransaction)
|
||||
def update_stats_on_change(sender, instance, **kwargs):
|
||||
update_product_stats(instance)
|
||||
update_quota_stats(instance)
|
||||
|
||||
Reference in New Issue
Block a user