!5308 添加功能

Merge pull request !5308 from 李鹏宇/zhou
This commit is contained in:
李鹏宇
2025-09-23 02:51:23 +00:00
committed by Gitee
2 changed files with 27 additions and 27 deletions
+2 -2
View File
@@ -208,7 +208,7 @@ class GoApprovals(models.Model):
if attendance_records:
attendance_records.write({
'is_workflow': True,
'workflow_id':workflow_id.id,
'workflow_id':workflow_id,
'is_clock_card': True,
'is_no_card': False,
'is_early_card': False,
@@ -221,7 +221,7 @@ class GoApprovals(models.Model):
while current_date <= end:
self.env['hr.attendance'].create({
'is_workflow': True,
'workflow_id': workflow_id.id,
'workflow_id': workflow_id,
'employee_id': employee.id,
date_field: current_date,
'is_clock_card': True,
@@ -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: