From d0e8c12bd2577128d677d56999802ae0a549b8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 18 Nov 2025 18:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_property/models/property_meter_archives.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py index 2cdaa8d0b..cd3f05bfd 100644 --- a/yuthon_property/models/property_meter_archives.py +++ b/yuthon_property/models/property_meter_archives.py @@ -240,17 +240,17 @@ class MeterArchivesLine(models.Model): maximum_count = fields.Integer(string="最大位数") is_push = fields.Boolean(string='推送', default=False) - @api.depends('current_meter', 'last_dosage') + @api.depends('current_read', 'last_read') def _compute_is_abnormal(self): """ 计算是否异常:本次读数与上次读数差值超过50%则为True """ for rec in self: rec.is_abnormal = False - if not rec.last_dosage or not rec.current_meter: + if not rec.last_read or not rec.current_read: continue - diff = abs(rec.current_meter - rec.last_dosage) - diff_ratio = diff / rec.last_dosage + diff = abs(rec.current_read - rec.last_read) + diff_ratio = diff / rec.last_read if diff_ratio > 0.5: rec.is_abnormal = True