operation list count_work 字段

This commit is contained in:
caoqianming 2022-01-13 16:08:11 +08:00
parent 8a162fbe58
commit a6591c341c
1 changed files with 1 additions and 2 deletions

View File

@ -261,8 +261,7 @@ class OperationListSerializer(serializers.ModelSerializer):
if obj.step.type == Step.STEP_TYPE_NOM:
count_work = OperationWproduct.objects.filter(operation=obj).count()
else:
count_work = OperationMaterial.objects.filter(operation=obj).annotate(count_work=Sum('count'))
print(count_work)
count_work = OperationMaterial.objects.filter(operation=obj).aggregate(count_work=Sum('count'))['count_work']
return count_work
def get_equip_(self, obj):