添加功能

This commit is contained in:
李鹏宇
2026-07-16 10:58:13 +08:00
parent 6685056cee
commit 4fa6e810f5
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -1111,7 +1111,7 @@ class HolidaysRequestBatch(models.Model):
], limit=1)
if not reports_id:
raise UserError(
'该员工暂无育儿假额度,请在员工档案的紧急联系人中配置子女信息(含身份证号)后重新计算')
'该员工暂无育儿假额度,请在员工档案的紧急联系人中配置子女信息(含身份证号)')
remaining_parental = round(reports_id.remaining_parental_leave or 0.0, 1)
if total_parental_leave_days > remaining_parental:
# 判断是没有分配还是用完了
@@ -1121,7 +1121,7 @@ class HolidaysRequestBatch(models.Model):
)
if not valid_parenting_lines:
raise UserError(
'该员工暂无育儿假额度,请在员工档案的紧急联系人中配置子女信息(含身份证号)后重新计算')
'该员工暂无育儿假额度,请在员工档案的紧急联系人中配置子女信息(含身份证号)')
else:
raise UserError(
f'育儿假额度不足,无法请假')
@@ -223,6 +223,12 @@ class YuthonOnboardApproval(models.Model):
matched_groups = self.env['res.groups'].sudo().search([
('department_ids.name', 'ilike', self.company_id.name)
])
# 排除"用户类型"分类下的组(内部用户/门户/公开),避免触发 _check_one_user_type 约束
user_type_category = self.env.ref('base.module_category_user_type', raise_if_not_found=False)
if user_type_category:
matched_groups = matched_groups.filtered(
lambda g: g.category_id.id != user_type_category.id
)
if matched_groups:
matched_groups.sudo().write({'users': [(4, employee_id.user_id.id)]})
iots = self.env['attendance.iot'].sudo().search([('company_id', '=', self.company_id.id)])