添加功能

This commit is contained in:
zhou
2025-08-21 18:21:39 +08:00
parent 0a754a29a4
commit bf038530bb
@@ -173,9 +173,7 @@ class PropertyReconciliationWizard(models.Model):
# 计算补全违约金的日期范围:当月1号 ~ 当月最后1天
year, month = map(int, due_month.split('-'))
first_day = datetime(year, month, 1).date()
last_day = (datetime(year, month + 1, 1).date() - relativedelta(days=1)) if month != 12 else datetime(
year, 12, 31).date()
penalty_days = (last_day - first_day).days + 1 # 当月总天数
penalty_days = (self.actual_date - first_day).days + 1 # 当月总天数
penalty_amount = penalty_days * round(contract.rent * float(contract_id.percentage_liquidated_damages.name), 2) if contract else 0.0
if penalty_amount > 0:
missing_penalty_lines.append((0, 0, {
@@ -186,7 +184,7 @@ class PropertyReconciliationWizard(models.Model):
'rent': penalty_amount,
'amount': 0,
'collection_type': 'penalty',
'remake': f'违约金({fields.Date.to_string(first_day)}至{fields.Date.to_string(last_day)},共{penalty_days}天)',
'remake': f'违约金({fields.Date.to_string(first_day)}至{fields.Date.to_string(self.actual_date)},共{penalty_days}天)',
}))
if missing_penalty_lines:
self.write({ 'reconciliation_line_ids': missing_penalty_lines})