little fix

This commit is contained in:
caoqianming 2022-01-26 15:08:17 +08:00
parent 1b5b0a5032
commit b3a399d8aa
2 changed files with 1 additions and 2 deletions

View File

@ -13,6 +13,7 @@ from django.utils import timezone
from apps.system.mixins import CreateUpdateModelAMixin
from apps.inm.signals import update_inm
from rest_framework import serializers
from django.db.models import Count
class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
"""

View File

@ -470,8 +470,6 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer.is_valid(raise_exception=True)
vdata = serializer.validated_data
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()
order = vdata['order']
if wp.material != order.product: