From dbad1522184c5e24dc1fc65acc8077b81b6df82b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 12 Jun 2025 10:37:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20wmaterial=20get=E5=9C=A8=E4=BC=A0?= =?UTF-8?q?=E5=85=A5query=E5=8F=82=E6=95=B0=E6=97=B6=E5=AE=8C=E5=96=84can?= =?UTF-8?q?=5Fdo=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 19e4c697..0873e902 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -202,7 +202,8 @@ class WMaterialSerializer(CustomModelSerializer): def to_representation(self, instance): ret = super().to_representation(instance) - ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working'])) + if 'count' in ret: + ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working'])) return ret class MlogbDefectSerializer(CustomModelSerializer):