little fix
This commit is contained in:
parent
1b5b0a5032
commit
b3a399d8aa
|
@ -13,6 +13,7 @@ from django.utils import timezone
|
||||||
from apps.system.mixins import CreateUpdateModelAMixin
|
from apps.system.mixins import CreateUpdateModelAMixin
|
||||||
from apps.inm.signals import update_inm
|
from apps.inm.signals import update_inm
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
from django.db.models import Count
|
||||||
|
|
||||||
class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
|
class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -470,8 +470,6 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
vdata = serializer.validated_data
|
vdata = serializer.validated_data
|
||||||
wps = WProduct.objects.filter(id__in = [i.id for i in vdata.get('wproducts')])
|
wps = WProduct.objects.filter(id__in = [i.id for i in vdata.get('wproducts')])
|
||||||
if wps.filter(need_to_order = False).exists():
|
|
||||||
raise exceptions.ValidationError('存在不需要指派订单的产品')
|
|
||||||
wp = wps.first()
|
wp = wps.first()
|
||||||
order = vdata['order']
|
order = vdata['order']
|
||||||
if wp.material != order.product:
|
if wp.material != order.product:
|
||||||
|
|
Loading…
Reference in New Issue