From b6be7ea637f97085f4b1dbef41ec7ecc32ecfc0d 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, 2 Dec 2025 11:45:31 +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 | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 67530cf64..b02db874c 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -548,6 +548,7 @@ class PropertyReconciliationWizard(models.Model): # 检查是否已有相同记录 existing_record = self.env['property.accounts.receivable'].search(check_domain) is_reconciliation = round(line.amount,2) == round(line.rent, 2) + receivable_id = self.env['property.accounts.receivable'] if not existing_record and is_create: domain2 = [ ('due_date', '=', line.due_date), @@ -585,15 +586,17 @@ class PropertyReconciliationWizard(models.Model): if existing_record: receivable_id = existing_record - self.env['receivable.modify.line'].create({ - 'bank_id': rec.bank_id.id, - 'not_collected': line.rent, - 'is_write': True if line.amount != 0 else False, - 'is_penalty': True, - 'reconciliation_date': rec.actual_date if line.amount != 0 else None, - 'receivable_id': receivable_id.id, - 'amount': line.amount, - }) + + if receivable_id: + self.env['receivable.modify.line'].create({ + 'bank_id': rec.bank_id.id, + 'not_collected': line.rent, + 'is_write': True if line.amount != 0 else False, + 'is_penalty': True, + 'reconciliation_date': rec.actual_date if line.amount != 0 else None, + 'receivable_id': receivable_id.id, + 'amount': line.amount, + }) rec.amount_been_reconciled += line.amount yes_amount += line.amount