From de42dfc75fbee01e3a63ba710eb86cece5ab5239 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 12 Sep 2024 11:24:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20wmaterial=20=E8=BF=94=E5=9B=9Ecount=5Fwo?= =?UTF-8?q?rking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)