add - import validator for organization quota stats
This commit is contained in:
@@ -5,6 +5,7 @@ from django.db.models import Sum, Q
|
||||
from django.db.models.signals import post_save, post_delete, post_init
|
||||
from django.dispatch import receiver
|
||||
|
||||
from apps.product.validators.quota_stats_validator import QuotaStatsValidator
|
||||
from apps.warehouse.models import (
|
||||
InventoryQuotaSaleTransaction,
|
||||
InventoryEntry
|
||||
@@ -80,7 +81,11 @@ def update_product_stats(instance: Product, distribution: QuotaDistribution = No
|
||||
user = get_current_user() # get user object
|
||||
if not isinstance(user, AnonymousUser):
|
||||
organization = get_organization_by_user(user)
|
||||
|
||||
QuotaStatsValidator.validate_assigner_has_enough(
|
||||
organization,
|
||||
distribution.quota,
|
||||
distribution.weight
|
||||
)
|
||||
if ProductStats.objects.filter(
|
||||
organization=organization,
|
||||
product=instance,
|
||||
|
||||
Reference in New Issue
Block a user