fix: 转成 小数后的to_representation bug
This commit is contained in:
parent
5bda6adf92
commit
53a3105f10
|
@ -25,6 +25,7 @@ from apps.qm.serializers import FtestProcessSerializer
|
|||
import logging
|
||||
from apps.qm.models import Defect
|
||||
from apps.utils.snowflake import idWorker
|
||||
from decimal import Decimal
|
||||
mylogger = logging.getLogger("log")
|
||||
|
||||
class OtherLogSerializer(CustomModelSerializer):
|
||||
|
@ -200,7 +201,7 @@ class WMaterialSerializer(CustomModelSerializer):
|
|||
|
||||
def to_representation(self, instance):
|
||||
ret = super().to_representation(instance)
|
||||
ret['count_cando'] = ret['count'] - ret['count_working']
|
||||
ret['count_cando'] = str(Decimal(ret['count']) - Decimal(ret['count_working']))
|
||||
return ret
|
||||
|
||||
class MlogbDefectSerializer(CustomModelSerializer):
|
||||
|
|
Loading…
Reference in New Issue