fix: wmaterial get在传入query参数时完善can_do的逻辑

This commit is contained in:
caoqianming 2025-06-12 10:37:19 +08:00
parent bb56becb5d
commit dbad152218
1 changed files with 2 additions and 1 deletions

View File

@ -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):