diff --git a/yuthon_base/security/ir.model.access.csv b/yuthon_base/security/ir.model.access.csv index 5de4e65d4..b8bfd38af 100644 --- a/yuthon_base/security/ir.model.access.csv +++ b/yuthon_base/security/ir.model.access.csv @@ -4,5 +4,5 @@ access_ir_cron_type,ir.cron.type,model_ir_cron_type,base.group_system,1,1,1,1 access_yuthon_timed_tasks,yuthon.timed.tasks,model_yuthon_timed_tasks,base.group_system,1,1,1,1 access_users_home_batch_wizard,access_users_home_batch_wizard,model_users_home_batch_wizard,base.group_user,1,1,1,1 access_phone_lottery,phone.lottery,model_phone_lottery,base.group_user,1,1,1,1 -access_base_year,base.year,model_base_year,base.group_system,1,1,1,1 -access_base_month,base.month,model_base_month,base.group_system,1,1,1,1 \ No newline at end of file +access_base_year,base.year,model_base_year,base.group_user,1,1,1,1 +access_base_month,base.month,model_base_month,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_hr_attendance/controllers/portal.py b/yuthon_hr_attendance/controllers/portal.py index d6c1736f7..5420d287f 100644 --- a/yuthon_hr_attendance/controllers/portal.py +++ b/yuthon_hr_attendance/controllers/portal.py @@ -74,46 +74,34 @@ class CustomerPortal(portal.CustomerPortal): @http.route('/phone/vacation/self/detail', type='http', auth="none", csrf=False, cors='*') def phone_vacation_self_detail(self, **kw): record = request.env['yuthon.vacation.reports'].sudo().search([('id', '=', kw.get('id'))]) - current_date = record.vacation_date - if current_date.month == 1: - last_month_year = current_date.year - 1 - last_month = 12 - else: - last_month_year = current_date.year - last_month = current_date.month - 1 - records = request.env['yuthon.vacation.reports'].sudo().search([ - ('employee_id', '=', record.employee_id.id), - ('vacation_date', '>=', f'{last_month_year}-{last_month:02d}-01'), - ('vacation_date', '<', f'{last_month_year}-{last_month + 1:02d}-01' if last_month < 12 else f'{last_month_year + 1}-01-01') - ], limit=1) data = { 'state': '已确认' if record.vacation_state == 'confirmed' else '待确认', '日期': record.display_date, - '应到': records.should_attendance, - '实到': records.actual_attendance, - '迟到': records.is_late_card, - '早退': records.is_early_card, - '缺卡': records.is_no_card, - '旷工': records.is_work, - '异常': records.is_abnormal, - '年假': records.done_leave, - '加班时': records.done_working_overtime, - '调休': records.compensatory_leave, - '事假': records.leave_of_absence, - '加班时(法定假)': records.statutory_leave, - '育儿假': records.parental_leave, - '值班调休': records.duty_off_leave, - '婚假': records.marriage_leave, - '产假': records.maternity_leave, - '陪产假': records.paternity_leave, - '计生假': records.family_planning_leave, - '丧假': records.bereavement_leave, - '探亲假': records.home_visit_leave, - '家长会假': records.parents_meeting_leave, - '病假(普通)': records.general_sick_leave, - '病假(住院期)': records.hospital_sick_leave, - '病假(出院恢复期)': records.recovery_sick_leave, - '考试假': records.exam_leave, + '应到': record.should_attendance, + '实到': record.actual_attendance, + '迟到': record.is_late_card, + '早退': record.is_early_card, + '缺卡': record.is_no_card, + '旷工': record.is_work, + '异常': record.is_abnormal, + '年假': record.done_leave, + '加班时': record.done_working_overtime, + '调休': record.compensatory_leave, + '事假': record.leave_of_absence, + '加班时(法定假)': record.statutory_leave, + '育儿假': record.parental_leave, + '值班调休': record.duty_off_leave, + '婚假': record.marriage_leave, + '产假': record.maternity_leave, + '陪产假': record.paternity_leave, + '计生假': record.family_planning_leave, + '丧假': record.bereavement_leave, + '探亲假': record.home_visit_leave, + '家长会假': record.parents_meeting_leave, + '病假(普通)': record.general_sick_leave, + '病假(住院期)': record.hospital_sick_leave, + '病假(出院恢复期)': record.recovery_sick_leave, + '考试假': record.exam_leave, } return json.dumps({'data': data, 'code': 200, 'message': ''}) 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..e93a9bbb3 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( @@ -916,6 +918,7 @@ class YuthonVacationReports(models.Model): 'medical_fee': last_month_record.medical_fee, 'previous_year': last_month_record.previous_year, 'valid_date': last_month_record.valid_date, + 'remaining_parental_leave': last_month_record.remaining_parental_leave, 'year_distribution': last_month_record.year_distribution, 'used_this_year': last_month_record.used_this_year, 'last_holiday': last_month_record.last_holiday, @@ -937,7 +940,7 @@ class YuthonVacationReports(models.Model): if rec.remaining_parental_leave and last_month_record.parenting_line_ids: update_date = last_month_record.parenting_line_ids[0].update_date end_date = last_month_record.parenting_line_ids[0].end_date - if rec.end_date: + if end_date: date_condition = update_date <= rec.vacation_date <= end_date else: date_condition = rec.vacation_date >= update_date @@ -1248,7 +1251,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):