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