From 3baa4dad858bc43928a12c757a3fa9c09ee29023 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Tue, 19 Aug 2025 11:33:53 +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 --- .../wizard/property_reconciliation_wizard.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 648b3d3bd..73e710f51 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -8,7 +8,7 @@ class PropertyReconciliationWizard(models.Model): _name = 'property.reconciliation.wizard' _description = '对账弹窗' - receivable_total = fields.Float(string='应收金额') + receivable_total = fields.Float(string='应收金额', compute="_compute_receivable_total", store=True) bank_id = fields.Many2one('property.bank.statements', string='银行流水') account = fields.Char(string='账号') amount_been_reconciled = fields.Float(string='已对金额', store=True) @@ -18,6 +18,11 @@ class PropertyReconciliationWizard(models.Model): initial_total = fields.Float(string='初始金额', default=0.0) reconciliation_line_ids = fields.One2many('property.reconciliation.line', 'reconciliation_id', string='对账明细') + @api.depends('reconciliation_line_ids') + def _compute_receivable_total(self): + for rec in self: + rec.receivable_total = sum(line.rent for line in rec.reconciliation_line_ids) + # @api.depends('reconciliation_line_ids') # def _compute_amount(self): # pass @@ -157,12 +162,12 @@ class PropertyReconciliationWizard(models.Model): ('tenant_id.name', '!=', False) ]) if bank_lines: - if rec.actual_total == rec.receivable_total: + if rec.actual_total > rec.receivable_total: + rec.bank_id.registered = rec.actual_total - rec.receivable_total + rec.bank_id.bank_state = 'registered' + else: rec.bank_id.registered = 0 rec.bank_id.bank_state = 'reconciled' - else: - rec.bank_id.registered = abs(rec.actual_total - rec.receivable_total) - rec.bank_id.bank_state = 'registered' first_line = bank_lines[0] for line in rec.reconciliation_line_ids: