fix - distribution validation
This commit is contained in:
@@ -82,8 +82,12 @@ 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 amount > self.instance.remaining_weight + self.instance.weight:
|
if not self.instance.parent_distribution:
|
||||||
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
if amount + total > self.instance.quota.quota_weight:
|
||||||
|
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
||||||
|
else:
|
||||||
|
if amount + total > self.instance.parent_distribution.weight:
|
||||||
|
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user