From e83c5ff59f18294a2511334fa0591db4e7432540 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 6 Dec 2021 10:21:18 +0800 Subject: [PATCH] =?UTF-8?q?sale=20=E5=88=9B=E5=BB=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/sam/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hb_server/apps/sam/serializers.py b/hb_server/apps/sam/serializers.py index b28a913..e4ce902 100644 --- a/hb_server/apps/sam/serializers.py +++ b/hb_server/apps/sam/serializers.py @@ -75,6 +75,7 @@ class SaleCreateSerializer(serializers.ModelSerializer): @transaction.atomic def create(self, validated_data): iproducts = validated_data.pop('iproducts') + validated_data['count'] = len(iproducts) sale = Sale.objects.create(**validated_data) i_l = [] for i in iproducts: