diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py
index 15a948021..df6442b52 100644
--- a/yuthon_hr_attendance/__manifest__.py
+++ b/yuthon_hr_attendance/__manifest__.py
@@ -16,7 +16,9 @@
'soong_workflow', 'yuthon_issue', 'planning', 'calendar'],
'data': [
'security/ir.model.access.csv',
+ 'security/attendance_security_group.xml',
'data/attendance_code_data.xml',
+ 'data/attendance_role_groups_data.xml',
'data/attendance_time_data.xml',
'views/hr_attendance_views.xml',
'views/resource_calendar_leaves_views.xml',
diff --git a/yuthon_hr_attendance/data/attendance_role_groups_data.xml b/yuthon_hr_attendance/data/attendance_role_groups_data.xml
new file mode 100644
index 000000000..0e03c60dc
--- /dev/null
+++ b/yuthon_hr_attendance/data/attendance_role_groups_data.xml
@@ -0,0 +1,27 @@
+
+
+
+ 运行班排班计划管理员
+ departmental_role
+
+
+ 高压班排班计划管理员
+ departmental_role
+
+
+ 综合班排班计划管理员
+ departmental_role
+
+
+ 班组A排班计划管理员
+ departmental_role
+
+
+ 班组B排班计划管理员
+ departmental_role
+
+
+ 班组C排班计划管理员
+ departmental_role
+
+
\ No newline at end of file
diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py
index 3a0ccaa58..44709629a 100644
--- a/yuthon_hr_attendance/models/__init__.py
+++ b/yuthon_hr_attendance/models/__init__.py
@@ -10,6 +10,7 @@ from . import card_approval
from . import planning_template_inherit
from . import overtime_page
from . import inherit_planning_role
+from . import inherit_hr_employee
from . import yuthon_shift_planning
from . import yuthon_run_planning
from . import duty_approval
diff --git a/yuthon_hr_attendance/models/inherit_hr_employee.py b/yuthon_hr_attendance/models/inherit_hr_employee.py
new file mode 100644
index 000000000..b826f38f7
--- /dev/null
+++ b/yuthon_hr_attendance/models/inherit_hr_employee.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+from odoo import api, fields, models
+
+
+class YuthonHrEmployee(models.Model):
+ _inherit = "hr.employee"
+
+ user_role_ids_changed = fields.Boolean(compute='_compute_user_roles')
+
+ @api.depends('user_role_ids')
+ def _compute_user_roles(self):
+ group_mapping = {
+ '运行班排班计划管理员': 'group_property_run_admin',
+ '高压班排班计划管理员': 'group_property_hv_admin',
+ '综合班排班计划管理员': 'group_property_integrated_admin',
+ '班组A排班计划管理员': 'group_property_class_a_admin',
+ '班组B排班计划管理员': 'group_property_class_b_admin',
+ '班组C排班计划管理员': 'group_property_class_c_admin',
+ }
+ old_users_ids = self.user_role_ids
+ for employee in self:
+ for role in employee.user_role_ids:
+ group_id = group_mapping.get(role.name)
+ if group_id:
+ group = self.env.ref('yuthon_hr_attendance.' + group_id, raise_if_not_found=False)
+ if group:
+ # 未知因素屏蔽选择值
+ group.write({'users': [(4, employee.user_id.id)]})
+ self.user_role_ids = old_users_ids
+ self.user_role_ids_changed = True
diff --git a/yuthon_hr_attendance/models/yuthon_shift_planning.py b/yuthon_hr_attendance/models/yuthon_shift_planning.py
index c4bcf1d44..45ca9408a 100644
--- a/yuthon_hr_attendance/models/yuthon_shift_planning.py
+++ b/yuthon_hr_attendance/models/yuthon_shift_planning.py
@@ -12,6 +12,8 @@ class YuthonShiftPlanning(models.Model):
planning_a_ids = fields.One2many('yuthon.shift.planning.a.line', 'shift_planning_id', string='关联A组')
planning_b_ids = fields.One2many('yuthon.shift.planning.b.line', 'shift_planning_id', string='关联B组')
planning_c_ids = fields.One2many('yuthon.shift.planning.c.line', 'shift_planning_id', string='关联C组')
+ planning_ever_white_ids = fields.One2many('yuthon.shift.ever.white.line', 'shift_planning_id', string='关联常白班')
+ planning_ever_night_ids = fields.One2many('yuthon.shift.ever.night.line', 'shift_planning_id', string='关联常夜班')
def confirm(self):
start_date = datetime.now().replace(day=1) # 获取本月第一天零点
@@ -23,7 +25,7 @@ class YuthonShiftPlanning(models.Model):
planning_groups = {
'planning_a_ids': range(len(role)), # 默认顺序: 早 -> 中 -> 夜
'planning_b_ids': [1, 2, 0], # 中 -> 夜 -> 早
- 'planning_c_ids': [2, 1, 0] # 夜 -> 中 -> 早
+ 'planning_c_ids': [2, 0, 1] # 夜 -> 早 -> 中
}
for planning_group, role_order in planning_groups.items():
@@ -64,6 +66,9 @@ class YuthonShiftPlanningALine(models.Model):
employee_id = fields.Many2one('hr.employee', string='人员',
domain=lambda self: [('department_id.name', 'in', ['保安部', '班组A', '班组B','班组C'])])
sequence = fields.Integer(string='序号')
+ regular_holidays = fields.Selection([('one', '星期一'), ('two', '星期二'), ('three', '星期三'),
+ ('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
+ ('seven', '星期日')], string='固定休息日')
shift_planning_id = fields.Many2one('yuthon.shift.planning', string='关联排班安排')
@@ -74,6 +79,9 @@ class YuthonShiftPlanningBLine(models.Model):
employee_id = fields.Many2one('hr.employee', string='人员',
domain=lambda self: [('department_id.name', 'in', ['保安部', '班组A', '班组B','班组C'])])
sequence = fields.Integer(string='序号')
+ regular_holidays = fields.Selection([('one', '星期一'), ('two', '星期二'), ('three', '星期三'),
+ ('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
+ ('seven', '星期日')], string='固定休息日')
shift_planning_id = fields.Many2one('yuthon.shift.planning', string='关联排班安排')
@@ -84,6 +92,35 @@ class YuthonShiftPlanningCLine(models.Model):
employee_id = fields.Many2one('hr.employee', string='人员',
domain=lambda self: [('department_id.name', 'in', ['保安部', '班组A', '班组B','班组C'])])
sequence = fields.Integer(string='序号')
+ regular_holidays = fields.Selection([('one', '星期一'), ('two', '星期二'), ('three', '星期三'),
+ ('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
+ ('seven', '星期日')], string='固定休息日')
+ shift_planning_id = fields.Many2one('yuthon.shift.planning', string='关联排班安排')
+
+
+class YuthonShiftEverWhiteLine(models.Model):
+ _name = 'yuthon.shift.ever.white.line'
+ _description = '常白班'
+
+ employee_id = fields.Many2one('hr.employee', string='人员',
+ domain=lambda self: [('department_id.name', 'in', ['保安部', '班组A', '班组B','班组C'])])
+ sequence = fields.Integer(string='序号')
+ regular_holidays = fields.Selection([('one', '星期一'), ('two', '星期二'), ('three', '星期三'),
+ ('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
+ ('seven', '星期日')], string='固定休息日')
+ shift_planning_id = fields.Many2one('yuthon.shift.planning', string='关联排班安排')
+
+
+class YuthonShiftEverNightLine(models.Model):
+ _name = 'yuthon.shift.ever.night.line'
+ _description = '常夜班'
+
+ employee_id = fields.Many2one('hr.employee', string='人员',
+ domain=lambda self: [('department_id.name', 'in', ['保安部', '班组A', '班组B','班组C'])])
+ sequence = fields.Integer(string='序号')
+ regular_holidays = fields.Selection([('one', '星期一'), ('two', '星期二'), ('three', '星期三'),
+ ('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
+ ('seven', '星期日')], string='固定休息日')
shift_planning_id = fields.Many2one('yuthon.shift.planning', string='关联排班安排')
diff --git a/yuthon_hr_attendance/security/attendance_security_group.xml b/yuthon_hr_attendance/security/attendance_security_group.xml
new file mode 100644
index 000000000..22561b046
--- /dev/null
+++ b/yuthon_hr_attendance/security/attendance_security_group.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ 排班计划权限
+
+
+ 运行班排班计划管理员
+
+
+
+
+ 高压班排班计划管理员
+
+
+
+
+ 综合班排班计划管理员
+
+
+
+
+ 班组A排班计划管理员
+
+
+
+
+ 班组B排班计划管理员
+
+
+
+
+ 班组C排班计划管理员
+
+
+
+
+
diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv
index 9a8cf7902..0dbb4a35f 100644
--- a/yuthon_hr_attendance/security/ir.model.access.csv
+++ b/yuthon_hr_attendance/security/ir.model.access.csv
@@ -21,4 +21,6 @@ access_yuthon_run_planning,yuthon.run.planning,model_yuthon_run_planning,base.gr
access_yuthon_engineering_run_line,engineering.run.line,model_yuthon_engineering_run_line,base.group_user,1,1,1,1
access_yuthon_high_run_line,high.run.line,model_yuthon_high_run_line,base.group_user,1,1,1,1
access_yuthon_all_run_line,all.run.line,model_yuthon_all_run_line,base.group_user,1,1,1,1
-access_yuthon_other_line,yuthon.other.line,model_yuthon_other_line,base.group_user,1,1,1,1
\ No newline at end of file
+access_yuthon_other_line,yuthon.other.line,model_yuthon_other_line,base.group_user,1,1,1,1
+access_yuthon_shift_ever_white_line,shift.ever.white.line,model_yuthon_shift_ever_white_line,base.group_user,1,1,1,1
+access_yuthon_shift_ever_night_line,shift.ever.night.line,model_yuthon_shift_ever_night_line,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml
index 3d2c22de2..99821c739 100644
--- a/yuthon_hr_attendance/views/hr_attendance_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_views.xml
@@ -114,4 +114,10 @@
tree
[('employee_id.department_id.name','in',['工程部', '运行班', '高压班','综合班'])]]
+
+ 全部考勤
+ hr.attendance
+ tree,form
+ [('employee_id.department_id.name','in',['仓储组', '综合组','保管组', '机安组', '1库', '2库', '3库', '联安粮库'])]]
+
diff --git a/yuthon_hr_attendance/views/inherit_planning_slot_views.xml b/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
index 77ac286ee..de54f47f7 100644
--- a/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
+++ b/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
@@ -9,19 +9,83 @@
-
- 保安部排班计划
+
+ planning.slot.form.inherit
+ planning.slot
+
+
+
+ 1
+
+
+
+
+
+
+
+ 全部
+ planning.slot
+ gantt,calendar,tree,form,kanban,pivot,graph
+
+ {'planning_expand_resource': 1, 'planning_expand_role': 1, 'search_default_group_by_resource': 1,
+ 'search_default_group_by_department': 1}
+
+ [('department_id.name', 'in', ['保安部', '班组A', '班组A', '班组C'])]
+
+
+ 班组A
planning.slot
gantt,calendar,tree,form,kanban,pivot,graph
{'planning_expand_resource': 1, 'planning_expand_role': 1}
- [('department_id.name','in',['保安部', '班组A', '班组B','班组C'])]
+ [('department_id.name', '=', '班组A')]
+
+
+ 班组B
+ planning.slot
+ gantt,calendar,tree,form,kanban,pivot,graph
+ {'planning_expand_resource': 1, 'planning_expand_role': 1}
+ [('department_id.name', '=', '班组B')]
+
+
+ 班组C
+ planning.slot
+ gantt,calendar,tree,form,kanban,pivot,graph
+ {'planning_expand_resource': 1, 'planning_expand_role': 1}
+ [('department_id.name', '=', '班组C')]
- 工程部排班计划
+ 全部
+ planning.slot
+ tree
+ gantt,calendar,tree,form,kanban,pivot,graph
+ [('department_id.name', 'in', ['工程部','高压班','运行班','综合班')]]
+
+ {'planning_expand_resource': 1, 'planning_expand_role': 1, 'search_default_group_by_resource': 1,
+ 'search_default_group_by_department': 1}
+
+
+
+ 运行班
planning.slot
tree
gantt,calendar,tree,form,kanban,pivot,graph
{'planning_expand_resource': 1, 'planning_expand_role': 1}
- [('department_id.name','in',['工程部', '运行班', '高压班','综合班'])]]
+ [('department_id.name', '=', '运行班')]]
+
+
+ 高压班
+ planning.slot
+ tree
+ gantt,calendar,tree,form,kanban,pivot,graph
+ {'planning_expand_resource': 1, 'planning_expand_role': 1}
+ [('department_id.name', '=', '高压班')]]
+
+
+ 综合班
+ planning.slot
+ tree
+ gantt,calendar,tree,form,kanban,pivot,graph
+ {'planning_expand_resource': 1, 'planning_expand_role': 1}
+ [('department_id.name','=','综合班')]]
\ No newline at end of file
diff --git a/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml b/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml
index e1f42a102..6f1d78bbc 100644
--- a/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml
+++ b/yuthon_hr_attendance/views/yuthon_shift_planning_views.xml
@@ -30,6 +30,7 @@
+
@@ -38,6 +39,7 @@
+
@@ -46,6 +48,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_work_brand/views/attendance_menu.xml b/yuthon_work_brand/views/attendance_menu.xml
index 83f8e1a29..f72609deb 100644
--- a/yuthon_work_brand/views/attendance_menu.xml
+++ b/yuthon_work_brand/views/attendance_menu.xml
@@ -27,12 +27,34 @@
-
+
+
+
+
+
+
+
+
+
-
+
+
+ sequence="15"/>
+ sequence="19"/>
+ sequence="99"/>