From aa449006f853dbb5ffb33cec080a8e27efb7e814 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: Thu, 30 Oct 2025 10:48:16 +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 | 6 +++--- .../wizard/property_reconciliation_wizard.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py index 0ece59989..a426a5c0c 100644 --- a/yuthon_property/models/property_meter_archives.py +++ b/yuthon_property/models/property_meter_archives.py @@ -216,7 +216,7 @@ class MeterArchivesLine(models.Model): unit_number = fields.Char(string="单元编号/用途") gauge_magnification = fields.Integer(string="仪表倍率", default=1) last_reading_time = fields.Date(string="最后读数时间") - receivables = fields.Float(string="应收", compute="_compute_receivables", store=True, help="应收金额=本次用量*单价*(1+线损)") + receivables = fields.Float(string="应收", store=True, help="应收金额=本次用量*单价*(1+线损)") unit = fields.Float(string="当月单价", group_operator=None, digits=(16, 4)) line_loss = fields.Float(string="线损", default=0.02) type = fields.Selection([("public", "公共"), ("fees", "收费")], string="类型") @@ -254,8 +254,8 @@ class MeterArchivesLine(models.Model): else: record.current_meter = 0 - @api.depends('line_loss', 'current_meter', 'unit') - def _compute_receivables(self): + @api.constrains('line_loss', 'current_meter', 'unit') + def _constrains_receivables(self): for record in self: if record.line_loss and record.current_meter and record.unit: raw_value = record.current_meter * record.unit * (1 + record.line_loss) * record.gauge_magnification diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 49958f796..feaf73fec 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -407,6 +407,7 @@ class PropertyReconciliationWizard(models.Model): rec.bank_id.registered = 0 rec.bank_id.bank_state = 'reconciled' rec.bank_id.reconciliation_time = fields.Datetime.now() - timedelta(hours=8) + yes_amount = 0 for line in rec.reconciliation_line_ids: # 跳过金额为0的行 if (line.amount == 0 and line.collection_type != 'penalty') or \ @@ -519,10 +520,10 @@ class PropertyReconciliationWizard(models.Model): 'amount': line.amount, }) - # 计算已对账和未对账金额 rec.amount_been_reconciled += line.amount + yes_amount += line.amount - rec.bank_id.yes_amount = rec.amount_water + rec.amount_water_been + rec.bank_id.yes_amount = yes_amount rec.bank_id.change_amount = sum(line.amount for line in rec.reconciliation_line_ids) all_contracts = self.bank_id.contract_ids