From 43ad0025e4b401d504a4d08d855c9389072bf11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Fri, 5 Jun 2026 18:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_property_approval/models/inherit_yuthon_property.py | 6 ++++++ .../wizard/property_reconciliation_wizard.py | 2 +- .../wizard/property_reconciliation_wizard_views.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index bece194a0..8a6bff747 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -510,6 +510,12 @@ class PropertyBankStatements(models.Model): all_vals.extend(fee_vals) all_vals.extend(rename_vals) + # 按 due_date 正序排列,最早日期在最上面 + all_vals.sort(key=lambda x: (x[2].get('due_date') or date.max, x[2].get('contract_id') or 0)) + # 重新设置 sequence,确保按正序从 10 开始递增 + for idx, val in enumerate(all_vals, start=1): + val[2]['sequence'] = idx * 10 + return all_vals, total_rent_month, return [], 0 diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 23d38e40f..98d185a57 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -543,7 +543,7 @@ class PropertyReconciliationWizard(models.Model): class PropertyReconciliationLine(models.Model): _name = 'property.reconciliation.line' _description = '对账明细' - _order = 'due_date desc' + _order = 'sequence, due_date' reconciliation_id = fields.Many2one('property.reconciliation.wizard', string='关联对账单弹窗') sequence = fields.Integer(string='顺序') diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml index 74495bf5e..7ebb560a9 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml @@ -62,7 +62,7 @@ - +