添加功能

This commit is contained in:
李鹏宇
2026-02-02 10:57:30 +08:00
parent a3c2f04f68
commit 6f830498e4
3 changed files with 9 additions and 2 deletions
@@ -345,14 +345,20 @@ class OvertimeApprovals(models.Model):
workday = 0.0
legal_day = 0.0
public_holidays = 0.0
year_workday = 0.0
year_holiday = 0.0
if record.type_overtime == 'work':
workday = record.duration
year_workday = record.duration
elif record.type_overtime == 'weekend':
public_holidays = record.duration
year_holiday = record.duration
elif record.type_overtime == 'holiday':
legal_day = record.duration
reports_id.year_holiday += year_holiday
reports_id.year_workday += year_workday
overtime_data = {
'vacation_id': reports_id.id,
'update_type': 'add',
@@ -278,6 +278,8 @@ class YuthonVacationReports(models.Model):
)
total_over_increase = sum(l.workday + l.public_holidays for l in over_increase_lines if l.workday or l.public_holidays) / 8
rec.this_year1 = total_over_increase # 本年剩余初始值=增加总额
rec.year_workday = sum(l.workday for l in over_increase_lines if l.workday) / 8
rec.year_holiday = sum(l.public_holidays for l in over_increase_lines if l.public_holidays) / 8
# 4. 筛选overtime_ids中workflow_record_id有值且update_type="减少"的明细,计算总减少额
over_decrease_lines = rec.overtime_ids.filtered(
@@ -1248,7 +1250,7 @@ class YuthonVacationReports(models.Model):
], limit=1)
if existing_line:
continue
self.env['vacation.parenting.line'].create({
self.env['vacation.parenting.line'].sudo().create({
'vacation_id': report.id,
'employee_id': report.employee_id.id,
'update_date': update_date,
-1
View File
@@ -71,7 +71,6 @@ class YuthonNotice(models.Model):
publish_date = fields.Date(string='发布日期')
@api.depends_context('uid', 'company')
@api.depends('company_id')
def _compute_is_company(self):