diff --git a/yuthon_hr_attendance/report/duty_arrangement_report.xml b/yuthon_duty_plan/report/duty_arrangement_report.xml
similarity index 100%
rename from yuthon_hr_attendance/report/duty_arrangement_report.xml
rename to yuthon_duty_plan/report/duty_arrangement_report.xml
diff --git a/yuthon_hr_attendance/report/duty_summary_report.xml b/yuthon_duty_plan/report/duty_summary_report.xml
similarity index 100%
rename from yuthon_hr_attendance/report/duty_summary_report.xml
rename to yuthon_duty_plan/report/duty_summary_report.xml
diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py
index 2c5f646d8..15a948021 100644
--- a/yuthon_hr_attendance/__manifest__.py
+++ b/yuthon_hr_attendance/__manifest__.py
@@ -24,8 +24,6 @@
'views/inherit_planning_slot_views.xml',
'views/inherit_planning_slot_template_views.xml',
'views/yuthon_shift_planning_views.xml',
- 'views/yuthon_hv_planning_views.xml',
- 'views/yuthon_overall_planning_views.xml',
'views/yuthon_run_planning_views.xml',
'views/overtime_approval.xml',
'views/go_approval.xml',
diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py
index 2b4d058a7..95838ccc6 100644
--- a/yuthon_hr_attendance/models/__init__.py
+++ b/yuthon_hr_attendance/models/__init__.py
@@ -13,7 +13,5 @@ from . import inherit_planning_role
from . import inherit_planning_slot_template
from . import inherit_planning_slot
from . import yuthon_shift_planning
-from . import yuthon_hv_planning
-from . import yuthon_overall_planning
from . import yuthon_run_planning
from . import duty_approval
diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py
index 7776ea610..4e120b775 100644
--- a/yuthon_hr_attendance/models/hr_attendance.py
+++ b/yuthon_hr_attendance/models/hr_attendance.py
@@ -62,14 +62,12 @@ class HrAttendance(models.Model):
min_hour_from = record.employee_id.resource_id.calendar_id.attendance_ids[0].hour_from
min_hour = int(min_hour_from)
min_minute = int(min_hour_from * 10 % min_hour_from)
-
if record.check_in:
check_in = record.check_in + timedelta(hours=8)
will_datetime_start = check_in.replace(hour=min_hour, minute=min_minute)
record.is_late_card = check_in > will_datetime_start
else:
record.is_no_card = True
-
max_hour_to = record.employee_id.resource_id.calendar_id.attendance_ids[-1].hour_to
max_hour = int(max_hour_to)
max_minute = int(max_hour_to * 10 % max_hour_to)
diff --git a/yuthon_hr_attendance/models/inherit_planning_role.py b/yuthon_hr_attendance/models/inherit_planning_role.py
index a153e3e50..efa164551 100644
--- a/yuthon_hr_attendance/models/inherit_planning_role.py
+++ b/yuthon_hr_attendance/models/inherit_planning_role.py
@@ -9,9 +9,9 @@ class PlanningRole(models.Model):
department_id = fields.Many2one('hr.department', string="部门")
def button_department_employee(self):
- resource_list=[]
+ resource_list = []
for record in self:
- child_ids = self.env['hr.department'].search([('parent_id', '=', record.department_id.id)])
+ child_ids = self.env['hr.department'].search([('parent_id', '=', record.department_id.id)])
if child_ids:
for child in child_ids:
employee_ids = self.env['hr.employee'].search([('department_id', '=', child.id)])
@@ -22,3 +22,15 @@ class PlanningRole(models.Model):
self.write({
'resource_ids': resource_list,
})
+
+
+class PlanningSlotTemplate(models.Model):
+ _inherit = 'planning.slot.template'
+
+ department_id = fields.Many2one('hr.department', string="部门")
+
+
+class InheritPlanningSlot(models.Model):
+ _inherit = 'planning.slot'
+
+ department_id = fields.Many2one('hr.department', string="部门")
diff --git a/yuthon_hr_attendance/models/inherit_planning_slot.py b/yuthon_hr_attendance/models/inherit_planning_slot.py
deleted file mode 100644
index 8f8fb9dea..000000000
--- a/yuthon_hr_attendance/models/inherit_planning_slot.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from odoo import api, fields, models, tools
-from odoo.exceptions import ValidationError
-
-
-class InheritPlanningSlot(models.Model):
- _inherit = 'planning.slot'
-
- department_id = fields.Many2one('hr.department', string="部门")
diff --git a/yuthon_hr_attendance/models/inherit_planning_slot_template.py b/yuthon_hr_attendance/models/inherit_planning_slot_template.py
deleted file mode 100644
index 09afce977..000000000
--- a/yuthon_hr_attendance/models/inherit_planning_slot_template.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from odoo import api, fields, models, tools
-from odoo.exceptions import ValidationError
-
-
-class PlanningSlotTemplate(models.Model):
- _inherit = 'planning.slot.template'
-
- department_id = fields.Many2one('hr.department', string="部门")
\ No newline at end of file
diff --git a/yuthon_hr_attendance/models/yuthon_hv_planning.py b/yuthon_hr_attendance/models/yuthon_hv_planning.py
deleted file mode 100644
index 49dbd3e0e..000000000
--- a/yuthon_hr_attendance/models/yuthon_hv_planning.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from odoo import api, fields, models, tools, _
-from datetime import datetime, time, timedelta
-from odoo.exceptions import UserError
-
-
-class YuthonHvPlanning(models.Model):
- _name = 'yuthon.hv.planning'
- _description = '高压班排班安排'
-
- name = fields.Char(string='排班计划名称', required=True)
- illustrate = fields.Char(string='排班说明', default='默认轮排到下个月')
- engineering_hv_ids = fields.One2many('yuthon.engineering.hv.line', 'hv_planning_id', string='工程部运行班计划')
-
-
-class YuthonEngineeringHvLine(models.Model):
- _name = 'yuthon.engineering.hv.line'
- _description = '工程部高压班计划明细'
-
- employee_id = fields.Many2one('hr.employee', string='人员',
- domain=lambda self: [('department_id.name', '=', '高压班')])
- sequence = fields.Integer(string='序号')
- hv_planning_id = fields.Many2one('yuthon.hv.planning', string='关联运行班排班计划')
diff --git a/yuthon_hr_attendance/models/yuthon_overall_planning.py b/yuthon_hr_attendance/models/yuthon_overall_planning.py
deleted file mode 100644
index 387812c8d..000000000
--- a/yuthon_hr_attendance/models/yuthon_overall_planning.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from odoo import api, fields, models, tools, _
-from datetime import datetime, time, timedelta
-from odoo.exceptions import UserError
-
-
-class YuthonOverallPlanning(models.Model):
- _name = 'yuthon.overall.planning'
- _description = '综合班排班安排'
-
- name = fields.Char(string='排班计划名称', required=True)
- illustrate = fields.Char(string='排班说明', default='默认轮排到下个月')
- overall_ids = fields.One2many('yuthon.engineering.overall.planning', 'overall_planning_id', string='综合排班计划')
-
-
-class YuthonEngineeringOverallPlanning(models.Model):
- _name = 'yuthon.engineering.overall.planning'
- _description = '工程综合班排班安排'
-
- employee_id = fields.Many2one('hr.employee', string='人员',
- domain=lambda self: [('department_id.name', '=', '综合班')])
- sequence = fields.Integer(string='序号')
- overall_planning_id = fields.Many2one('yuthon.overall.planning', string='关联运行班排班计划')
diff --git a/yuthon_hr_attendance/models/yuthon_run_planning.py b/yuthon_hr_attendance/models/yuthon_run_planning.py
index 3a54f55ba..1aae6dca7 100644
--- a/yuthon_hr_attendance/models/yuthon_run_planning.py
+++ b/yuthon_hr_attendance/models/yuthon_run_planning.py
@@ -1,5 +1,3 @@
-from dateutils import years
-
from odoo import api, fields, models, tools, _
from datetime import datetime, time, timedelta
from odoo.exceptions import UserError
@@ -7,12 +5,13 @@ from odoo.exceptions import UserError
class YuthonRunPlanning(models.Model):
_name = 'yuthon.run.planning'
- _description = '运行班排班计划'
+ _description = '工程部排班计划'
name = fields.Char(string='排班计划名称', required=True)
illustrate = fields.Char(string='排班说明', default='默认轮排到下个月')
- engineering_run_ids = fields.One2many('yuthon.engineering.run.line', 'engineering_planning_id',
- string='关联运行班排班明细')
+ engineering_run_ids = fields.One2many('yuthon.engineering.run.line', 'engineering_planning_id', string='关联工程部排班明细')
+ high_run_ids = fields.One2many('yuthon.high.run.line', 'engineering_planning_id', string='关联工程部排班明细')
+ all_run_ids = fields.One2many('yuthon.all.run.line', 'engineering_planning_id', string='关联工程部排班明细')
def confirm(self):
today = datetime.today().date()
@@ -69,58 +68,30 @@ class YuthonRunPlanning(models.Model):
'sticky': False,
}
}
- # employees = self.engineering_run_ids
- # num_employees = len(employees)
- # for employee in employees:
- # current_date = start_date
- # # 计算下个月的第一天
- # if current_date.month == 12:
- # next_month_start = datetime(current_date.year + 1, 1, 1, 0, 0, 0)
- # else:
- # next_month_start = datetime(current_date.year, current_date.month + 1, 1, 0, 0, 0)
- #
- # while current_date < next_month_start and current_date <= end_date:
- # self.create_planning_slot(employee, role_a.id, self.get_role_template(role_a), current_date)
- # current_date += timedelta(days=1)
- #
- # current_date = start_date
- # while current_date <= end_date:
- # current_employee = employees[(current_date - start_date).days % num_employees]
- # self.create_planning_slot(current_employee, role_b.id, self.get_role_template(role_b), current_date)
- # current_date += timedelta(days=1)
-
- # def create_planning_slot(self, record, role, role_template, current_date):
- # start_hour = int(role_template.start_time)
- # start_minute = int(round((role_template.start_time - start_hour) * 60))
- # end_hour = int(role_template.end_time)
- # end_minute = int(round((role_template.end_time - end_hour) * 60))
- #
- # start_time = current_date.replace(hour=start_hour, minute=start_minute, second=0,
- # microsecond=0) + timedelta(hours=16)
- # if role_template.end_time < role_template.start_time:
- # end_time = (current_date + timedelta(days=1)).replace(hour=end_hour, minute=end_minute, second=0,
- # microsecond=0) + timedelta(hours=16)
- # else:
- # end_time = current_date.replace(hour=end_hour, minute=end_minute, second=0,
- # microsecond=0) + timedelta(hours=16)
- #
- # self.env['planning.slot'].create({
- # 'resource_id': record.employee_id.resource_id.id,
- # 'role_id': role,
- # 'start_datetime': start_time,
- # 'end_datetime': end_time,
- # 'allocated_hours': 8,
- # })
- #
- # def get_role_template(self, role):
- # return self.env['planning.slot.template'].search([('role_id', '=', role.id)], limit=1)
class YuthonEngineeringRunLine(models.Model):
_name = 'yuthon.engineering.run.line'
- _description = '工程部运行班计划明细'
+ _description = '运行班计划明细'
- employee_id = fields.Many2one('hr.employee', string='人员',
- domain=lambda self: [('department_id.name', '=', '运行班')])
+ employee_id = fields.Many2one('hr.employee', string='人员',domain=lambda self: [('department_id.name', '=', '运行班')])
sequence = fields.Integer(string='序号')
- engineering_planning_id = fields.Many2one('yuthon.run.planning', string='关联运行班排班计划')
+ engineering_planning_id = fields.Many2one('yuthon.run.planning', string='关联工程部排班计划')
+
+
+class YuthonHighRunLine(models.Model):
+ _name = 'yuthon.high.run.line'
+ _description = '高压班计划明细'
+
+ employee_id = fields.Many2one('hr.employee', string='人员', domain=lambda self: [('department_id.name', '=', '高压班')])
+ sequence = fields.Integer(string='序号')
+ engineering_planning_id = fields.Many2one('yuthon.run.planning', string='关联工程部排班计划')
+
+
+class YuthonAllRunLine(models.Model):
+ _name = 'yuthon.all.run.line'
+ _description = '综合班计划明细'
+
+ employee_id = fields.Many2one('hr.employee', string='人员', domain=lambda self: [('department_id.name', '=', '综合班')])
+ sequence = fields.Integer(string='序号')
+ engineering_planning_id = fields.Many2one('yuthon.run.planning', string='关联工程部排班计划')
diff --git a/yuthon_hr_attendance/models/yuthon_shift_planning.py b/yuthon_hr_attendance/models/yuthon_shift_planning.py
index 3973a0f51..1b772b8ff 100644
--- a/yuthon_hr_attendance/models/yuthon_shift_planning.py
+++ b/yuthon_hr_attendance/models/yuthon_shift_planning.py
@@ -4,7 +4,7 @@ from datetime import datetime, time, timedelta
class YuthonShiftPlanning(models.Model):
_name = 'yuthon.shift.planning'
- _description = '排班安排'
+ _description = '保安部排班安排'
name = fields.Char(string='排班名称', required=True)
illustrate = fields.Char(string='排班说明', default='默认按ABC三组轮排到下个月')
diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv
index 74f5a98f5..941b73c00 100644
--- a/yuthon_hr_attendance/security/ir.model.access.csv
+++ b/yuthon_hr_attendance/security/ir.model.access.csv
@@ -8,15 +8,16 @@ access_attendance_scheme,attendance_scheme,model_attendance_scheme,base.group_us
access_go_approvals_line,go.approvals.line,model_go_approvals_line,base.group_user,1,1,1,1
access_overtime_user_line,overtime.user.line,model_overtime_user_line,base.group_user,1,1,1,1
access_overtime_page,overtime.page,model_overtime_page,base.group_user,1,1,1,1
+access_duty_approval,duty.approval,model_duty_approval,base.group_user,1,1,1,1
+access_duty_approval_line,duty.approval.line,model_duty_approval_line,base.group_user,1,1,1,1
+
+
access_yuthon_shift_planning,yuthon.shift.planning,model_yuthon_shift_planning,base.group_user,1,1,1,1
access_yuthon_shift_planning_a_line,yuthon.shift.planning.a.line,model_yuthon_shift_planning_a_line,base.group_user,1,1,1,1
access_yuthon_shift_planning_b_line,yuthon.shift.planning.b.line,model_yuthon_shift_planning_b_line,base.group_user,1,1,1,1
access_yuthon_shift_planning_c_line,yuthon.shift.planning.c.line,model_yuthon_shift_planning_c_line,base.group_user,1,1,1,1
-access_yuthon_hv_planning,yuthon.hv.planning,model_yuthon_hv_planning,base.group_user,1,1,1,1
-access_yuthon_engineering_hv_line,yuthon.engineering.hv.line,model_yuthon_engineering_hv_line,base.group_user,1,1,1,1
-access_yuthon_yuthon_overall_planning,yuthon.overall.planning,model_yuthon_overall_planning,base.group_user,1,1,1,1
-access_yuthon_engineering_overall_planning,engineering.overall.planning,model_yuthon_engineering_overall_planning,base.group_user,1,1,1,1
+
access_yuthon_run_planning,yuthon.run.planning,model_yuthon_run_planning,base.group_user,1,1,1,1
access_yuthon_engineering_run_line,engineering.run.line,model_yuthon_engineering_run_line,base.group_user,1,1,1,1
-access_duty_approval,duty.approval,model_duty_approval,base.group_user,1,1,1,1
-access_duty_approval_line,duty.approval.line,model_duty_approval_line,base.group_user,1,1,1,1
\ No newline at end of file
+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
\ 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 fd4e87976..95d7850c1 100644
--- a/yuthon_hr_attendance/views/hr_attendance_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_views.xml
@@ -103,24 +103,12 @@
全部考勤
hr.attendance
tree,form
- [('employee_id.department_id.name', '=', '保安部')]
+ [('employee_id.department_id.name','in',['保安部', '班组A', '班组B','班组C'])]
全部考勤
hr.attendance
tree
- [('employee_id.department_id.name', '=', '运行班')]
-
-
- 全部考勤
- hr.attendance
- tree
- [('employee_id.department_id.name' , '=' , '高压班')]
-
-
- 全部考勤
- hr.attendance
- tree
- [('employee_id.department_id.name', '=', '综合班')]
+ [('employee_id.department_id.name','in',['工程部', '运行班', '高压班','综合班'])]]
diff --git a/yuthon_hr_attendance/views/inherit_planning_slot_views.xml b/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
index 4da841f91..77ac286ee 100644
--- a/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
+++ b/yuthon_hr_attendance/views/inherit_planning_slot_views.xml
@@ -10,34 +10,18 @@
- 排班计划
+ 保安部排班计划
planning.slot
gantt,calendar,tree,form,kanban,pivot,graph
{'planning_expand_resource': 1, 'planning_expand_role': 1}
[('department_id.name','in',['保安部', '班组A', '班组B','班组C'])]
- 排班计划
+ 工程部排班计划
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', '=', '高压班')]
-
-
- 排班计划
- planning.slot
- tree
- gantt,calendar,tree,form,kanban,pivot,graph
- {'planning_expand_resource': 1, 'planning_expand_role': 1}
- [('department_id.name', '=', '综合班')]
+ [('department_id.name','in',['工程部', '运行班', '高压班','综合班'])]]
\ No newline at end of file
diff --git a/yuthon_hr_attendance/views/yuthon_hv_planning_views.xml b/yuthon_hr_attendance/views/yuthon_hv_planning_views.xml
deleted file mode 100644
index f17b1ac9f..000000000
--- a/yuthon_hr_attendance/views/yuthon_hv_planning_views.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- yuthon.hv.planning.tree
- yuthon.hv.planning
-
-
-
-
-
-
-
-
- yuthon.hv.planning.form
- yuthon.hv.planning
-
-
-
-
-
- 排班安排
- yuthon.hv.planning
- tree,form
-
-
diff --git a/yuthon_hr_attendance/views/yuthon_overall_planning_views.xml b/yuthon_hr_attendance/views/yuthon_overall_planning_views.xml
deleted file mode 100644
index c0d2b9cd7..000000000
--- a/yuthon_hr_attendance/views/yuthon_overall_planning_views.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- yuthon.overall.planning.tree
- yuthon.overall.planning
-
-
-
-
-
-
-
-
- yuthon.overall.planning.form
- yuthon.overall.planning
-
-
-
-
-
- 排班安排
- yuthon.overall.planning
- tree,form
-
-
diff --git a/yuthon_hr_attendance/views/yuthon_run_planning_views.xml b/yuthon_hr_attendance/views/yuthon_run_planning_views.xml
index 5988119ad..80823faee 100644
--- a/yuthon_hr_attendance/views/yuthon_run_planning_views.xml
+++ b/yuthon_hr_attendance/views/yuthon_run_planning_views.xml
@@ -23,9 +23,27 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_work_brand/views/attendance_menu.xml b/yuthon_work_brand/views/attendance_menu.xml
index d6219aa1a..83f8e1a29 100644
--- a/yuthon_work_brand/views/attendance_menu.xml
+++ b/yuthon_work_brand/views/attendance_menu.xml
@@ -15,10 +15,6 @@
parent="hr_attendance_root_board"
action="yuthon_hr_attendance.hr_attendance_action_is_abnormal"
sequence="2"/>
-
-
-
-
-
-
-
-
-
+ sequence="5"/>
+ sequence="7"/>
+
+
+
+
+ sequence="7"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
+
+
+