添加功能

This commit is contained in:
李鹏宇
2025-10-30 15:39:37 +08:00
parent 714488876d
commit 538cbda649
@@ -328,6 +328,7 @@ class PropertyReconciliationWizard(models.Model):
assign_amount = min(rent, remaining_amount)
line.amount = assign_amount
remaining_amount -= assign_amount
line.onchange_remake()
# 租金行分配完后,处理其他类型的行
if remaining_amount > 0:
@@ -339,34 +340,7 @@ class PropertyReconciliationWizard(models.Model):
assign_amount = min(rent, remaining_amount)
line.amount = assign_amount
remaining_amount -= assign_amount
self._update_line_remarks()
def _update_line_remarks(self):
"""
分配金额后,更新明细行的备注(复用原onchange中的备注生成逻辑)
"""
for rec in self:
for line in rec.reconciliation_line_ids:
if line.amount == 0 and line.collection_type != 'penalty':
line.remake = ""
continue
if line.amount and line.collection_type != 'penalty' and line.due_date and rec.actual_date:
actual_date = rec.actual_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')
if (due_month > actual_month and due_year == actual_year) or (due_year > actual_year):
if line.rent >= line.amount:
line.remake = f'{actual_date_str}预{due_date_str},欠{round(line.rent - line.amount, 2)}'
elif due_month == actual_month and due_year == actual_year:
if line.rent >= line.amount:
line.remake = f'交{due_date_str},欠{round(line.rent - line.amount, 2)}'
elif (due_month < actual_month and due_year == actual_year) or (due_year < actual_year):
if line.rent >= line.amount:
line.remake = f'{actual_date_str}补{due_date_str},欠{round(line.rent - line.amount, 2)}'
line.onchange_remake()
def confirm(self):
collection_type_mapping = {