diff --git a/apps/wpm/models.py b/apps/wpm/models.py index c5c7e53c..55b01cf0 100644 --- a/apps/wpm/models.py +++ b/apps/wpm/models.py @@ -108,8 +108,8 @@ class WMaterial(CommonBDModel): count_xtest = models.PositiveIntegerField('已检数量', null=True, blank=True) @property - def count_working(self, obj): - return Mlogb.objects.filter(wm_in=obj, mlog__work_end_time__isnull=True).aggregate(count=Sum('count'))['count'] or 0 + def count_working(self): + return Mlogb.objects.filter(wm_in=self, mlog__work_end_time__isnull=True).aggregate(count=Sum('count'))['count'] or 0 class Fmlog(CommonADModel): route = models.ForeignKey(Route, verbose_name='生产路线', on_delete=models.SET_NULL, null=True, blank=True)