diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 4c5abe957..1bf920589 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -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})