@@ -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
|
||||
|
||||
|
||||
@@ -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='顺序')
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<field name="warning_msg" style="color: red; font-weight: bold;" readonly="1" invisible="not warning_msg" string=" "/>
|
||||
</group>
|
||||
<field name="reconciliation_line_ids">
|
||||
<tree editable="bottom" create="false" delete="false">
|
||||
<tree editable="bottom" create="false" delete="false" default_order="due_date desc">
|
||||
<field name="sequence" column_invisible="1" />
|
||||
<field name="color" column_invisible="1" force_save="1"/>
|
||||
<field name="reconciliation_id" column_invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user