@@ -24,7 +24,7 @@ class YuthonDutyPlan(models.Model):
|
||||
duty_lines = []
|
||||
current_date = first_day_of_month
|
||||
while current_date <= last_day_of_month:
|
||||
for line in self.plan_line_ids:
|
||||
for line in self.plan_line_ids.sorted('sequence'):
|
||||
for employee in line.employee_ids:
|
||||
duty_lines.append({
|
||||
'employee_id': employee.id,
|
||||
|
||||
@@ -6,11 +6,18 @@ from datetime import datetime, timedelta, time, date
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools import format_time
|
||||
from random import randint, shuffle
|
||||
|
||||
|
||||
class PlanningTemplate(models.Model):
|
||||
_inherit = 'planning.slot.template'
|
||||
|
||||
def _get_default_color(self):
|
||||
return randint(1, 11)
|
||||
|
||||
planning_name = fields.Char(string='名称')
|
||||
color = fields.Integer("颜色", default=_get_default_color)
|
||||
|
||||
def _compute_name(self):
|
||||
super()._compute_name()
|
||||
user_tz = pytz.timezone(self.env['planning.slot']._get_tz())
|
||||
@@ -38,10 +45,24 @@ class PlanningTemplate(models.Model):
|
||||
duration_days = math.ceil((end_datetime - start_datetime).total_seconds() / (3600 * 24))
|
||||
return duration_days, timedelta(hours=end_datetime.hour, minutes=end_datetime.minute).total_seconds() / 3600
|
||||
|
||||
@api.depends("planning_name")
|
||||
def _compute_display_name(self):
|
||||
super()._compute_display_name()
|
||||
for record in self:
|
||||
record.display_name = f"{record.name} {record.role_id.name}{record.planning_name}"
|
||||
|
||||
|
||||
class Planning(models.Model):
|
||||
_inherit = 'planning.slot'
|
||||
|
||||
department_id = fields.Many2one('hr.department', string='部门')
|
||||
color = fields.Integer("Color", compute='_compute_color')
|
||||
|
||||
@api.depends('template_id.color')
|
||||
def _compute_color(self):
|
||||
for slot in self:
|
||||
slot.color = slot.template_id.color
|
||||
|
||||
# 修改原生自动安排函数
|
||||
@api.model
|
||||
def auto_plan_ids(self, view_domain):
|
||||
|
||||
@@ -13,65 +13,56 @@ class YuthonRunPlanning(models.Model):
|
||||
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='关联综合部排班明细')
|
||||
other_run_ids = fields.One2many('yuthon.other.line', 'engineering_planning_id', string='关联其他明细')
|
||||
|
||||
def confirm(self):
|
||||
run_lines_list = [self.engineering_run_ids, self.high_run_ids, self.all_run_ids]
|
||||
department_run_id = fields.Many2one("hr.department", string="部门", required=True, default=lambda self: self.env['hr.department'].search([('name', '=', '运行班')]))
|
||||
department_high_id = fields.Many2one("hr.department", string="部门", required=True, default=lambda self: self.env['hr.department'].search([('name', '=', '高压班')]))
|
||||
department_integrated_id = fields.Many2one("hr.department", string="部门", required=True, default=lambda self: self.env['hr.department'].search([('name', '=', '综合班')]))
|
||||
# 运行班
|
||||
def run_confirm(self):
|
||||
today = datetime.today().date()
|
||||
first_day_of_month = today.replace(day=1)
|
||||
if today.month < 12:
|
||||
last_day_of_month = (today.replace(month=today.month + 1, day=1) - timedelta(days=1))
|
||||
else:
|
||||
last_day_of_month = (today.replace(year=today.year + 1, month=1, day=1) - timedelta(days=1))
|
||||
role_a = self.env['planning.role'].search([('name', '=', '工程部白班')], limit=1)
|
||||
start_time = int(self.env['planning.slot.template'].search([('role_id', '=', role_a.id)]).start_time)
|
||||
end_time = int(self.env['planning.slot.template'].search([('role_id', '=', role_a.id)]).end_time)
|
||||
run = 0
|
||||
for run_lines in run_lines_list:
|
||||
if not run_lines:
|
||||
continue
|
||||
run += 1
|
||||
for employee in run_lines:
|
||||
current_date = first_day_of_month
|
||||
while current_date <= last_day_of_month:
|
||||
resource_id = employee.employee_id.resource_id
|
||||
self.env['planning.slot'].create({
|
||||
'resource_id': resource_id.id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day, start_time) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day, end_time) + timedelta(hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
role_b = self.env['planning.role'].search([('name', '=', '工程部中值夜班')], limit=1)
|
||||
start_time2 = int(self.env['planning.slot.template'].search([('role_id', '=', role_b.id)]).start_time)
|
||||
end_time2 = int(self.env['planning.slot.template'].search([('role_id', '=', role_b.id)]).end_time)
|
||||
if run == 1:
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '运行班')])
|
||||
elif run == 2:
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '高压班')])
|
||||
elif run == 3:
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '综合班')])
|
||||
|
||||
role_a = self.env['planning.role'].search([('name', '=', '工程部')], limit=1)
|
||||
start_time = int(self.env['planning.slot.template'].search([('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).start_time)
|
||||
end_time = int(self.env['planning.slot.template'].search([('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).end_time)
|
||||
for employee in self.engineering_run_ids:
|
||||
current_date = first_day_of_month
|
||||
i = -1
|
||||
while current_date <= last_day_of_month:
|
||||
for employee in range(0, len(run_lines)):
|
||||
i = i + 1
|
||||
slot_id = all_slot.search([('resource_id', '=', run_lines[employee].employee_id.resource_id.id)]).sorted('start_datetime')[i]
|
||||
slot_id.sudo().write({
|
||||
'template_id': self.env['planning.slot.template'].search([('role_id', '=', role_b.id)]).id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time2) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time2) + timedelta(days=1, hours=16),
|
||||
'role_id': role_b.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
resource_id = employee.employee_id.resource_id
|
||||
self.env['planning.slot'].create({
|
||||
'template_id': self.env['planning.slot.template'].search([('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).id,
|
||||
'resource_id': resource_id.id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day, start_time) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day, end_time) + timedelta(hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
start_time2 = int(self.env['planning.slot.template'].search([('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).start_time)
|
||||
end_time2 = int(self.env['planning.slot.template'].search([('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).end_time)
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '运行班')])
|
||||
current_date = first_day_of_month
|
||||
i = -1
|
||||
while current_date <= last_day_of_month:
|
||||
for employee in range(0, len(self.engineering_run_ids)):
|
||||
i = i + 1
|
||||
slot_id = all_slot.search([('resource_id', '=', self.engineering_run_ids[employee].employee_id.resource_id.id)]).sorted('start_datetime')[i]
|
||||
slot_id.sudo().write({
|
||||
'template_id': self.env['planning.slot.template'].search([('role_id', '=', role_a.id), ('planning_name', '=', '中值夜班')]).id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time2) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time2) + timedelta(days=1, hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
|
||||
other_data = {}
|
||||
for other in self.other_run_ids:
|
||||
@@ -92,18 +83,19 @@ class YuthonRunPlanning(models.Model):
|
||||
pass
|
||||
else:
|
||||
self.env['planning.slot'].create({
|
||||
'template_id': self.env['planning.slot.template'].search([('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).id,
|
||||
'resource_id': resource_id.id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time) + timedelta(hours=16),
|
||||
'role_id': role_a.id,
|
||||
''
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
@@ -113,7 +105,140 @@ class YuthonRunPlanning(models.Model):
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
# 高压班
|
||||
def high_confirm(self):
|
||||
today = datetime.today().date()
|
||||
first_day_of_month = today.replace(day=1)
|
||||
if today.month < 12:
|
||||
last_day_of_month = (today.replace(month=today.month + 1, day=1) - timedelta(days=1))
|
||||
else:
|
||||
last_day_of_month = (today.replace(year=today.year + 1, month=1, day=1) - timedelta(days=1))
|
||||
role_a = self.env['planning.role'].search([('name', '=', '工程部')], limit=1)
|
||||
start_time = int(self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).start_time)
|
||||
end_time = int(self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白夜班')]).end_time)
|
||||
for employee in self.high_run_ids:
|
||||
current_date = first_day_of_month
|
||||
while current_date <= last_day_of_month:
|
||||
resource_id = employee.employee_id.resource_id
|
||||
self.env['planning.slot'].create({
|
||||
'template_id': self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).id,
|
||||
'resource_id': resource_id.id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time) + timedelta(hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
start_time2 = int(self.env['planning.slot.template'].search(
|
||||
[('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).start_time)
|
||||
end_time2 = int(self.env['planning.slot.template'].search(
|
||||
[('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).end_time)
|
||||
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '高压班')])
|
||||
current_date = first_day_of_month
|
||||
i = -1
|
||||
while current_date <= last_day_of_month:
|
||||
for employee in range(0, len(self.high_run_ids)):
|
||||
i = i + 1
|
||||
slot_id = all_slot.search(
|
||||
[('resource_id', '=', self.high_run_ids[employee].employee_id.resource_id.id)]).sorted(
|
||||
'start_datetime')[i]
|
||||
slot_id.sudo().write({
|
||||
'template_id': self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '中值夜班')]).id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time2) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time2) + timedelta(days=1, hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'type': 'success',
|
||||
'message': '排班安排已完成',
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
# 综合班
|
||||
def integrated_confirm(self):
|
||||
today = datetime.today().date()
|
||||
first_day_of_month = today.replace(day=1)
|
||||
if today.month < 12:
|
||||
last_day_of_month = (today.replace(month=today.month + 1, day=1) - timedelta(days=1))
|
||||
else:
|
||||
last_day_of_month = (today.replace(year=today.year + 1, month=1, day=1) - timedelta(days=1))
|
||||
role_a = self.env['planning.role'].search([('name', '=', '工程部')], limit=1)
|
||||
start_time = int(self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).start_time)
|
||||
end_time = int(self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白夜班')]).end_time)
|
||||
for employee in self.all_run_ids:
|
||||
current_date = first_day_of_month
|
||||
while current_date <= last_day_of_month:
|
||||
resource_id = employee.employee_id.resource_id
|
||||
self.env['planning.slot'].create({
|
||||
'template_id': self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '白班')]).id,
|
||||
'resource_id': resource_id.id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time) + timedelta(hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
start_time2 = int(self.env['planning.slot.template'].search(
|
||||
[('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).start_time)
|
||||
end_time2 = int(self.env['planning.slot.template'].search(
|
||||
[('planning_name', '=', '中值夜班'), ('role_id', '=', role_a.id)]).end_time)
|
||||
|
||||
all_slot = self.env['planning.slot'].search([('department_id.name', '=', '综合班')])
|
||||
current_date = first_day_of_month
|
||||
i = -1
|
||||
while current_date <= last_day_of_month:
|
||||
for employee in range(0, len(self.all_run_ids)):
|
||||
i = i + 1
|
||||
slot_id = all_slot.search(
|
||||
[('resource_id', '=', self.all_run_ids[employee].employee_id.resource_id.id)]).sorted(
|
||||
'start_datetime')[i]
|
||||
slot_id.sudo().write({
|
||||
'template_id': self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_a.id), ('planning_name', '=', '中值夜班')]).id,
|
||||
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
start_time2) + timedelta(hours=16),
|
||||
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,
|
||||
end_time2) + timedelta(days=1, hours=16),
|
||||
'role_id': role_a.id,
|
||||
'allocated_hours': 8,
|
||||
})
|
||||
current_date += timedelta(days=1)
|
||||
if current_date > last_day_of_month:
|
||||
break
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'type': 'success',
|
||||
'message': '排班安排已完成',
|
||||
'sticky': False,
|
||||
}
|
||||
}
|
||||
|
||||
class YuthonEngineeringRunLine(models.Model):
|
||||
_name = 'yuthon.engineering.run.line'
|
||||
@@ -150,7 +275,7 @@ class YuthonOtherLine(models.Model):
|
||||
('four', '星期四'), ('five', '星期五'), ('six', '星期六'),
|
||||
('seven', '星期日')], string='固定休息日')
|
||||
employee_id = fields.Many2one('hr.employee', string='人员',
|
||||
domain=lambda self: [('department_id.name', 'in', ['综合班', '高压班', '运行班'])])
|
||||
domain=lambda self: [('department_id.name', 'in', ['运行班'])])
|
||||
sequence = fields.Integer(string='序号')
|
||||
engineering_planning_id = fields.Many2one('yuthon.run.planning', string='关联工程部排班计划')
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@ class YuthonShiftPlanning(models.Model):
|
||||
planning_ever_noon_ids = fields.One2many('yuthon.shift.ever.noon.line', 'shift_planning_id', string='关联常中班')
|
||||
|
||||
def confirm(self):
|
||||
start_date = datetime.now().replace(day=1) # 获取本月第一天零点
|
||||
end_date = (start_date + timedelta(days=32)).replace(day=1) # 获取下个月第一天零点
|
||||
role_a = self.env['planning.role'].search([('name', '=', '保安部白班')], limit=1)
|
||||
role_b = self.env['planning.role'].search([('name', '=', '保安部中班')], limit=1)
|
||||
role_c = self.env['planning.role'].search([('name', '=', '保安部夜班')], limit=1)
|
||||
role = [role_a, role_b, role_c]
|
||||
start_date = datetime.today().replace(day=1) # 获取本月日期
|
||||
end_date = (start_date + timedelta(days=32)).replace(day=1) # 获取下个月第一天日期
|
||||
role_a = self.env['planning.role'].search([('name', '=', '保安部')], limit=1)
|
||||
role_template_a = self.env['planning.slot.template'].search([('planning_name', '=', '白班'), ('role_id', '=', role_a.id)])
|
||||
role_template_b = self.env['planning.slot.template'].search([('planning_name', '=', '中班'), ('role_id', '=', role_a.id)])
|
||||
role_template_c = self.env['planning.slot.template'].search([('planning_name', '=', '夜班'), ('role_id', '=', role_a.id)])
|
||||
role = [role_template_a, role_template_b, role_template_c]
|
||||
planning_groups = {
|
||||
'planning_a_ids': range(len(role)), # 默认顺序: 早 -> 中 -> 夜
|
||||
'planning_b_ids': [1, 2, 0], # 中 -> 夜 -> 早
|
||||
@@ -59,9 +60,9 @@ class YuthonShiftPlanning(models.Model):
|
||||
if resource_id in ever_holidays and current_weekday in ever_holidays[resource_id]:
|
||||
pass # 跳过休息日
|
||||
else:
|
||||
role_template = self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role[role_index].id)], limit=1)
|
||||
self.create_planning_slot(record, role[role_index], role_template, current_date)
|
||||
# role_template = self.env['planning.slot.template'].search(
|
||||
# [('role_id', '=', role[role_index].id)], limit=1)
|
||||
self.create_planning_slot(record, role_a, role[role_index], current_date)
|
||||
current_date += timedelta(days=1)
|
||||
if current_date >= end_date:
|
||||
break
|
||||
@@ -99,9 +100,7 @@ class YuthonShiftPlanning(models.Model):
|
||||
if resource_id in ever_holidays and current_weekday in ever_holidays[resource_id]:
|
||||
pass # 跳过休息日
|
||||
else:
|
||||
role_template = self.env['planning.slot.template'].search(
|
||||
[('role_id', '=', role_item.id)], limit=1)
|
||||
self.create_planning_slot(record, role_item, role_template, current_date) # 确保这个方法存在
|
||||
self.create_planning_slot(record, role_a,role_item, current_date) # 确保这个方法存在
|
||||
current_date += timedelta(days=1)
|
||||
# 为白班员工创建排班
|
||||
create_shifts_for_group(self.planning_ever_white_ids, role[0])
|
||||
@@ -112,13 +111,15 @@ class YuthonShiftPlanning(models.Model):
|
||||
def create_planning_slot(self, record,role,role_template,current_date):
|
||||
start_hour = int(role_template.start_time)
|
||||
end_hour = int(role_template.end_time)
|
||||
start_time = current_date.replace(hour=start_hour)+ timedelta(hours=16)
|
||||
current_datetime = datetime.combine(current_date, time(0, 0, 0))
|
||||
start_time = current_datetime.replace(hour=start_hour)+ timedelta(hours=16)
|
||||
if role_template.end_time < role_template.start_time:
|
||||
end_time = current_date.replace(hour=end_hour)+ timedelta(days=1, hours=16)
|
||||
end_time = current_datetime.replace(hour=end_hour)+ timedelta(days=1, hours=16)
|
||||
else:
|
||||
end_time = current_date.replace(hour=end_hour)+ timedelta(hours=16)
|
||||
end_time = current_datetime.replace(hour=end_hour)+ timedelta(hours=16)
|
||||
self.env['planning.slot'].create({
|
||||
'resource_id': record.employee_id.resource_id.id,
|
||||
'template_id':role_template.id,
|
||||
'role_id':role.id,
|
||||
'start_datetime': start_time,
|
||||
'end_datetime': end_time,
|
||||
|
||||
@@ -2,20 +2,28 @@
|
||||
<record id="hr_planning_slot_template_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">planning.slot.template.tree.inherit</field>
|
||||
<field name="model">planning.slot.template</field>
|
||||
<field name="inherit_id" ref="planning.planning_slot_template_view_form"/>
|
||||
<field name="inherit_id" ref="planning.planning_slot_template_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='sequence']" position="after">
|
||||
<field name="planning_name" string="名称"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='role_id']" position="after">
|
||||
<field name="department_id" string="部门"/>
|
||||
<field name="color" widget="color_picker" optional="show"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_planning_slot_template_inherit_form" model="ir.ui.view">
|
||||
<field name="name">planning.slot.template.form.inherit</field>
|
||||
<field name="model">planning.slot.template</field>
|
||||
<field name="inherit_id" ref="planning.planning_slot_template_view_tree"/>
|
||||
<field name="inherit_id" ref="planning.planning_slot_template_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='role_id']" position="after">
|
||||
<field name="department_id" string="部门"/>
|
||||
<field name="color" widget="color_picker" optional="show"/>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='start_time']" position="before">
|
||||
<field name="planning_name" string="名称"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
<xpath expr="//div[@class='o_row']" position="replace">
|
||||
<field name="allocated_hours" string="已分配时间"/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='template_id']" position="attributes">-->
|
||||
<!-- <attribute name="domain">[('department_id', 'in', resource_id.department_id.id)]</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_planning_slot_all_form1" model="ir.actions.act_window">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<!--运行班排班-->
|
||||
<record id ="view_yuthon_run_planning_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.run.planning.form</field>
|
||||
<field name="model">yuthon.run.planning</field>
|
||||
@@ -17,11 +18,12 @@
|
||||
<form string="排班安排">
|
||||
<sheet>
|
||||
<header>
|
||||
<button name="confirm" type="object" string="安排" class="oe_highlight"/>
|
||||
<button name="run_confirm" type="object" string="安排" class="oe_highlight"/>
|
||||
</header>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="illustrate"/>
|
||||
<field name="department_run_id"/>
|
||||
</group>
|
||||
<group string="运行班安排">
|
||||
<field name="engineering_run_ids" string=" ">
|
||||
@@ -32,25 +34,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="高压班安排">
|
||||
<field name="high_run_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="engineering_planning_id" column_invisible="1"/>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="employee_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="综合班安排">
|
||||
<field name="all_run_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="engineering_planning_id" column_invisible="1"/>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="employee_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="其他">
|
||||
<group string="常白班">
|
||||
<field name="other_run_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="engineering_planning_id" column_invisible="1"/>
|
||||
@@ -64,9 +48,107 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 综合部排班 -->
|
||||
<record id ="view_yuthon_integrated_planning_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.integrated.planning.tree</field>
|
||||
<field name="model">yuthon.run.planning</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="排班安排">
|
||||
<field name="name"/>
|
||||
<field name="illustrate"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id ="view_yuthon_integrated_planning_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.integrated.planning.form</field>
|
||||
<field name="model">yuthon.run.planning</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="排班安排">
|
||||
<sheet>
|
||||
<header>
|
||||
<button name="integrated_confirm" type="object" string="安排" class="oe_highlight"/>
|
||||
</header>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="illustrate"/>
|
||||
<field name="department_integrated_id"/>
|
||||
</group>
|
||||
<group string="综合班安排">
|
||||
<field name="all_run_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="engineering_planning_id" column_invisible="1"/>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="employee_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<!--高压班排班-->
|
||||
<record id ="view_yuthon_high_planning_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.high.planning.tree</field>
|
||||
<field name="model">yuthon.run.planning</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="排班安排">
|
||||
<field name="name"/>
|
||||
<field name="illustrate"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id ="view_yuthon_high_planning_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.high.planning.form</field>
|
||||
<field name="model">yuthon.run.planning</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="排班安排">
|
||||
<sheet>
|
||||
<header>
|
||||
<button name="high_confirm" type="object" string="安排" class="oe_highlight"/>
|
||||
</header>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="illustrate"/>
|
||||
<field name="department_high_id"/>
|
||||
</group>
|
||||
<group string="高压班安排">
|
||||
<field name="high_run_ids" string=" ">
|
||||
<tree editable="bottom">
|
||||
<field name="engineering_planning_id" column_invisible="1"/>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="employee_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_yuthon_run_planning" model="ir.actions.act_window">
|
||||
<field name="name">排班安排</field>
|
||||
<field name="name">运行班安排</field>
|
||||
<field name="res_model">yuthon.run.planning</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('department_run_id.name', '=', '运行班')]</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_hr_attendance.view_yuthon_run_planning_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_hr_attendance.view_yuthon_run_planning_form')})]"/>
|
||||
</record>
|
||||
<record id="action_yuthon_integrated_planning" model="ir.actions.act_window">
|
||||
<field name="name">综合部安排</field>
|
||||
<field name="res_model">yuthon.run.planning</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('department_high_id.name', '=', '综合班')]</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_hr_attendance.view_yuthon_integrated_planning_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_hr_attendance.view_yuthon_integrated_planning_form')})]"/>
|
||||
</record>
|
||||
<record id="action_yuthon_high_planning" model="ir.actions.act_window">
|
||||
<field name="name">高压部安排</field>
|
||||
<field name="res_model">yuthon.run.planning</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('department_integrated_id.name', '=', '高压班')]</field>
|
||||
<field name="view_ids" eval="[(5, 0, 0),
|
||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_hr_attendance.view_yuthon_high_planning_tree')}),
|
||||
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_hr_attendance.view_yuthon_high_planning_form')})]"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -75,11 +75,26 @@
|
||||
name="工程部计划"
|
||||
parent="hr_attendance_root_board"
|
||||
sequence="7"/>
|
||||
<menuitem id="menu_hr_attendance_hv_board"
|
||||
<menuitem id="menu_hr_attendance_all_board"
|
||||
name="排班安排"
|
||||
parent="menu_hr_attendance_engineering_record_board"
|
||||
sequence="1"/>
|
||||
<menuitem id="menu_hr_attendance_planning_run_board"
|
||||
name="运行班"
|
||||
parent="menu_hr_attendance_all_board"
|
||||
action="yuthon_hr_attendance.action_yuthon_run_planning"
|
||||
sequence="1"/>
|
||||
<menuitem id="menu_hr_attendance_planning_high_board"
|
||||
name="高压班"
|
||||
parent="menu_hr_attendance_all_board"
|
||||
action="yuthon_hr_attendance.action_yuthon_high_planning"
|
||||
sequence="3"/>
|
||||
<menuitem id="menu_hr_attendance_planning_integrated_board"
|
||||
name="综合班"
|
||||
parent="menu_hr_attendance_all_board"
|
||||
action="yuthon_hr_attendance.action_yuthon_integrated_planning"
|
||||
sequence="5"/>
|
||||
|
||||
<menuitem id="menu_hr_plan_sources_board3"
|
||||
name="排班计划"
|
||||
parent="menu_hr_attendance_engineering_record_board"
|
||||
|
||||
Reference in New Issue
Block a user