fix distributoion creation bug
This commit is contained in:
@@ -56,6 +56,7 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
|||||||
if total + amount > quota.quota_weight:
|
if total + amount > quota.quota_weight:
|
||||||
raise QuotaWeightException()
|
raise QuotaWeightException()
|
||||||
|
|
||||||
|
if self.instance:
|
||||||
# total warehouse inventory entry
|
# total warehouse inventory entry
|
||||||
total_entry = self.instance.inventory_entry.aggregate(
|
total_entry = self.instance.inventory_entry.aggregate(
|
||||||
total=models.Sum('weight')
|
total=models.Sum('weight')
|
||||||
@@ -66,7 +67,6 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
|||||||
raise APIException("وزن وارد شده کمتر از وزن ورودی به انبار است", code=403) # noqa
|
raise APIException("وزن وارد شده کمتر از وزن ورودی به انبار است", code=403) # noqa
|
||||||
|
|
||||||
# if weight is more than distribution remaining weight
|
# if weight is more than distribution remaining weight
|
||||||
if self.instance:
|
|
||||||
if self.instance.weight > self.instance.remaining_weight:
|
if self.instance.weight > self.instance.remaining_weight:
|
||||||
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user