添加功能
This commit is contained in:
@@ -127,31 +127,31 @@ class PropertyReconciliationWizard(models.Model):
|
||||
'remake': f'违约金({start_date_str}至{end_date_str},共{late_days}天)',
|
||||
})
|
||||
|
||||
# 查找应收是否有未交全的租金
|
||||
unpaid_rent_recs = self.env['property.accounts.receivable'].search([
|
||||
('management_type_id.name', '=', '租金'),
|
||||
('contract_id', '=', contract_id.id),
|
||||
('submitted', '!=', 0),
|
||||
('payout_date', '!=', None),
|
||||
])
|
||||
if unpaid_rent_recs:
|
||||
if (unpaid_rent_recs.payout_date + relativedelta(months=1)).month != self.actual_date.month:
|
||||
first_day = (unpaid_rent_recs.payout_date + timedelta(days=1))
|
||||
last_month_rent = unpaid_rent_recs.submitted
|
||||
penalty_days = self.actual_date - first_day
|
||||
penalty_amount = (penalty_days.days + 1) * round(
|
||||
last_month_rent * float(contract_id.percentage_liquidated_damages.name), 2
|
||||
) if contract_id else 0.0
|
||||
if penalty_amount > 0:
|
||||
new_lines.append((0, 0, {
|
||||
'contract_id': contract_id.id if contract_id else None,
|
||||
'rent_month': 0,
|
||||
'due_date': fields.Date.to_string(first_day),
|
||||
'rent': penalty_amount,
|
||||
'amount': 0,
|
||||
'collection_type': 'penalty',
|
||||
'remake': f'违约金({fields.Date.to_string(first_day)}至{fields.Date.to_string(self.actual_date)},共{penalty_days.days + 1}天)',
|
||||
}))
|
||||
# 查找应收是否有未交全的租金
|
||||
unpaid_rent_recs = self.env['property.accounts.receivable'].search([
|
||||
('management_type_id.name', '=', '租金'),
|
||||
('contract_id', '=', contract_id.id),
|
||||
('submitted', '!=', 0),
|
||||
('payout_date', '!=', None),
|
||||
])
|
||||
if unpaid_rent_recs:
|
||||
if (unpaid_rent_recs.payout_date + relativedelta(months=1)).month != self.actual_date.month:
|
||||
first_day = (unpaid_rent_recs.payout_date + timedelta(days=1))
|
||||
last_month_rent = unpaid_rent_recs.submitted
|
||||
penalty_days = self.actual_date - first_day
|
||||
penalty_amount = (penalty_days.days + 1) * round(
|
||||
last_month_rent * float(contract_id.percentage_liquidated_damages.name), 2
|
||||
) if contract_id else 0.0
|
||||
if penalty_amount > 0:
|
||||
new_lines.append((0, 0, {
|
||||
'contract_id': contract_id.id if contract_id else None,
|
||||
'rent_month': 0,
|
||||
'due_date': fields.Date.to_string(first_day),
|
||||
'rent': penalty_amount,
|
||||
'amount': 0,
|
||||
'collection_type': 'penalty',
|
||||
'remake': f'违约金({fields.Date.to_string(first_day)}至{fields.Date.to_string(self.actual_date)},共{penalty_days.days + 1}天)',
|
||||
}))
|
||||
|
||||
# 3. 添加到总列表
|
||||
for vals in contract_penalties:
|
||||
|
||||
Reference in New Issue
Block a user