fix edit distribution exception bug
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
from rest_framework import serializers
|
||||
from apps.product import models as product_models
|
||||
from rest_framework.exceptions import APIException
|
||||
from apps.product.web.api.v1.serializers.quota_serializers import QuotaSerializer
|
||||
from django.db import models
|
||||
from rest_framework import serializers
|
||||
from rest_framework.exceptions import APIException
|
||||
|
||||
from apps.product import models as product_models
|
||||
from apps.product.exceptions import (
|
||||
QuotaWeightException,
|
||||
QuotaClosedException,
|
||||
QuotaExpiredTimeException,
|
||||
QuotaLimitByOrganizationException
|
||||
)
|
||||
from apps.product.web.api.v1.serializers.quota_serializers import QuotaSerializer
|
||||
|
||||
|
||||
class QuotaDistributionSerializer(serializers.ModelSerializer):
|
||||
@@ -67,7 +68,7 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
||||
raise APIException("وزن وارد شده کمتر از وزن ورودی به انبار است", code=403) # noqa
|
||||
|
||||
# if weight is more than distribution remaining weight
|
||||
if self.instance.weight > self.instance.remaining_weight:
|
||||
if amount > self.instance.remaining_weight + self.instance.weight:
|
||||
raise APIException("وزن وارد شده بیشتر از وزن باقیمانده است", code=403) # noqa
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user