This commit is contained in:
李鹏宇
2026-04-09 17:00:32 +08:00
3 changed files with 8 additions and 4 deletions
@@ -60,6 +60,7 @@ class HrAttendance(models.Model):
is_workflow = fields.Boolean(string="是否是流程", default=False)
workflow_id = fields.Many2one('soong.workflow.record', string="流程")
is_month = fields.Boolean(string="是否为本月数据", compute='_compute_month_status', store=True)
is_late_allowed = fields.Boolean(string="是否允许迟到", default=False)
is_last_month = fields.Boolean(string="是否为上月数据", compute='_compute_month_status', store=True)
correct_result = fields.Text(string="修正原因")
@@ -344,7 +344,7 @@ class HrAttendanceDetail(models.Model):
else:
sch_check_out_time = sch_check_out_time - timedelta(hours=1)
is_early_card, is_late_card, is_abnormal, is_warning, absenteeism_card, is_no_card = self.state_judgment(employee, check_in_time, check_out_time, sch_check_in_time, sch_check_out_time, current_data, is_manual)
is_early_card, is_late_card, is_abnormal, is_warning, absenteeism_card, is_no_card = self.state_judgment(employee, check_in_time, check_out_time, sch_check_in_time, sch_check_out_time, current_data, is_manual, attendance)
is_expatriation = self.env['expatriation.approval'].search([('work_end', '=', True),('expatriates_ids', 'in', [employee.id]), ('is_effect', '=', False)])
if not self._process_shift_days(current_data) and template.role_id.name == '集团行政':
start_datetime = datetime.combine(current_data, datetime.min.time())
@@ -475,7 +475,7 @@ class HrAttendanceDetail(models.Model):
minutes = int((hour_float - hours) * 60)
return datetime.combine(base_date, datetime.min.time()) + timedelta(hours=hours, minutes=minutes)
def state_judgment(self, employee, check_in, check_out, start_datetime, end_datetime, current_data, is_manual):
def state_judgment(self, employee, check_in, check_out, start_datetime, end_datetime, current_data, is_manual, attendance):
"""
判断打卡状态
:param check_in: 签到时间
@@ -555,8 +555,10 @@ class HrAttendanceDetail(models.Model):
if late_delta > 2:
is_late_card = True
else:
# 迟到超过10分钟 并且也算迟扣允许迟到次数 到
employee.late_allowed -= 1
if attendance.is_late_allowed == False:
# 迟到超过10分钟 并且也算迟扣允许迟到次数 到
employee.late_allowed -= 1
attendance.is_late_allowed = True
if late_delta > 10:
is_late_card = True
@@ -102,6 +102,7 @@
<field name="is_late_card" optional="show" class="list_ids_width" />
<field name="absenteeism_card" optional="show" class="list_ids_width" string="旷工" />
<field name="is_abnormal" optional="show" class="list_ids_width" string="异常" />
<field name="is_late_allowed" column_invisible="1"/>
<field name="abnormal" optional="show" column_invisible="1" />
<field name="work_time_type" column_invisible="1" />
<field name="is_approval" column_invisible="1" />