32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from rest_framework import status
|
|
from rest_framework.exceptions import APIException
|
|
|
|
|
|
class WareHouseException(APIException):
|
|
status_code = status.HTTP_400_BAD_REQUEST
|
|
default_detail = "مقدار ورد شده از انبار بیشتر از موجودی انبار میباشد" # noqa
|
|
default_code = 'error'
|
|
|
|
def __init__(self, message=None, code=None, status_code=None):
|
|
if status_code is not None:
|
|
self.status_code = status_code
|
|
|
|
detail = {
|
|
"message": message,
|
|
"status_code": status_code
|
|
}
|
|
|
|
super().__init__(detail)
|
|
|
|
|
|
class InventoryEntryWeightException(APIException):
|
|
status_code = status.HTTP_400_BAD_REQUEST
|
|
default_detail = "مقدار وارد شده برای ورودی به انبار از مقدار کل سهمیه توزیع داده شده بیشتر است" # noqa
|
|
default_code = 'error'
|
|
|
|
|
|
class TotalInventorySaleException(APIException):
|
|
status_code = status.HTTP_400_BAD_REQUEST
|
|
default_detail = "مقدار وارد شده برای فروش از انبار از موجودی انبار بیشتر میباشد" # noqa
|
|
default_code = 'error'
|