超过订单数量统计
This commit is contained in:
parent
fa4706207b
commit
e3e623c5e1
|
@ -42,6 +42,8 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
|||
with transaction.atomic():
|
||||
iproducts = vdata.pop('iproducts')
|
||||
vdata['count'] = len(iproducts)
|
||||
if vdata['count'] + vdata['order'].delivered_count > vdata['order'].count:
|
||||
raise exceptions.APIException('超过订单所需数量')
|
||||
sale = Sale.objects.create(**vdata)
|
||||
i_l = []
|
||||
for i in iproducts:
|
||||
|
|
Loading…
Reference in New Issue