diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index c51f7b59a..d263b21c3 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -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', diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index f8f379f51..2524344f5 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -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, diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 0d1e4708a..10d5647aa 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -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):