!11085 添加功能

Merge pull request !11085 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-04-22 02:43:49 +00:00
committed by Gitee
+15 -21
View File
@@ -83,27 +83,21 @@ class HrAttendance(models.Model):
@api.constrains("check_out")
def _check_out_in(self):
@api.constrains("check_out")
def _check_out_in(self):
for record in self:
# 只打印这两个值,出错就打印异常
try:
print("员工姓名:", record.employee_id.name)
print("当前日期:", record.current_data)
except Exception as e:
print("获取值失败:", e)
if record.shift_name in ['夜班', '旧晚(旧区府晚班)']:
current_data = record.current_data + timedelta(days=1)
else:
current_data = record.current_data
reminder_id = self.env['message.reminder.tasks'].search([
('name', '=', record.employee_id.name),
('state', '=', 'todo'),
('type', '=', 'offWork'),
('current_data', '=', current_data)
], limit=1)
if reminder_id:
reminder_id.state = 'done'
for record in self:
_logger.info('----------打卡取值验证--------')
_logger.info(f"当前员工姓名为{record.employee_id.name}, 当前日期为{record.current_data}")
if record.shift_name in ['夜班', '旧晚(旧区府晚班)']:
current_data = record.current_data + timedelta(days=1)
else:
current_data = record.current_data
reminder_id = self.env['message.reminder.tasks'].search([
('name', '=', record.employee_id.name),
('state', '=', 'todo'),
('type', '=', 'offWork'),
('current_data', '=', current_data)
], limit=1)
if reminder_id:
reminder_id.state = 'done'
def one_time(self):
for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))):