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,6 +202,7 @@ class WMaterialSerializer(CustomModelSerializer):
def to_representation(self, instance): def to_representation(self, instance):
ret = super().to_representation(instance) ret = super().to_representation(instance)
if 'count' in ret:
ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working'])) ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working']))
return ret return ret