From 4b65219ab391b2b2eaf2f91713aba72bab08984a 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: Fri, 13 Feb 2026 11:04:18 +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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 1980fe84b..6703779d0 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -656,19 +656,22 @@ class PropertyReconciliationLine(models.Model): if round(line.amount or 0, 2) == 0 and line.collection_type != 'penalty': line.remake = "" return - if line.amount and line.collection_type != 'penalty': + if line.amount and line.collection_type != 'penalty' and actual_date and line.due_date: due_date = line.due_date actual_year, actual_month = actual_date.year, actual_date.month due_year, due_month = due_date.year, due_date.month due_date_str = due_date.strftime('%Y-%m') actual_date_str = actual_date.strftime('%Y-%m-%d') - rent = round(line.rent or 0, 2) + rent = round(line.rent or 0, 2) + # 计算欠款金额并判断是否小于0 + debt_amount = round(rent - line.amount, 2) + debt_str = f',欠{debt_amount}' if debt_amount >= 0 else "" if (due_month > actual_month and due_year == actual_year) or (due_year > actual_year): if rent >= line.amount: - line.remake = f'{actual_date_str}预{due_date_str},欠{round(rent - line.amount, 2)}' + line.remake = f'{actual_date_str}预{due_date_str}{debt_str}' elif due_month == actual_month and due_year == actual_year: if rent >= line.amount: - line.remake = f'交{due_date_str},欠{round(rent - line.amount, 2)}' + line.remake = f'交{due_date_str}{debt_str}' elif (due_month < actual_month and due_year == actual_year) or (due_year < actual_year): if rent >= line.amount: - line.remake = f'{actual_date_str}补{due_date_str},欠{round(rent - line.amount, 2)}' \ No newline at end of file + line.remake = f'{actual_date_str}补{due_date_str}{debt_str}' \ No newline at end of file