添加功能

This commit is contained in:
zhouzhou
2024-12-09 10:00:49 +08:00
parent 25ba2e3bc0
commit 2aa2c76ac2
5 changed files with 20 additions and 20 deletions
@@ -4,7 +4,7 @@
<field name="name">yuthon.duty.arrangement.tree</field>
<field name="model">yuthon.duty.arrangement</field>
<field name="arch" type="xml">
<tree string="值班安排" decoration-danger="is_abnormal">
<tree string="值班排班" decoration-danger="is_abnormal">
<header>
<button name="button_all_duty" string="值班汇总计算" type="object" class="oe_highlight"/>
</header>
@@ -26,7 +26,7 @@
<field name="name">yuthon.duty.arrangement.form</field>
<field name="model">yuthon.duty.arrangement</field>
<field name="arch" type="xml">
<form string="值班安排">
<form string="值班排班">
<sheet>
<div class="oe_title">
<label for="employee_id"/>
@@ -84,7 +84,7 @@
<field name="model">yuthon.duty.arrangement</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="值班安排"
<calendar string="值班排班"
date_start="start_time"
date_stop="end_time"
event_open_popup="true"
@@ -95,7 +95,7 @@
</field>
</record>
<record id="view_yuthon_duty_arrangement_action" model="ir.actions.act_window">
<field name="name">值班安排</field>
<field name="name">值班排班</field>
<field name="res_model">yuthon.duty.arrangement</field>
<field name="view_mode">tree,form,calendar,search</field>
<field name="context">{'search_default_current_month': 1}</field>
+2 -2
View File
@@ -66,7 +66,7 @@ class HrAttendance(models.Model):
employee_ids = list(set(self.env['hr.attendance'].search([
('employee_id.department_id', 'in', department_ids)
]).mapped('employee_id').ids))
for employee_id in employee_ids:
for employee_id in self.env['hr.employee'].browse(employee_ids):
planning_ids = self.env['planning.slot'].search([('resource_id', '=', employee_id.resource_id.id)])
for planning_id in planning_ids:
start_date = planning_id.start_datetime.date()
@@ -80,7 +80,7 @@ class HrAttendance(models.Model):
department_ids = self.env['hr.department'].search([('name', 'in',['工程部', '运行班', '高压班','综合班'])]).ids
employee_ids = list(set(self.env['hr.attendance'].search([('employee_id.department_id', 'in', department_ids)
]).mapped('employee_id').ids))
for employee_id in employee_ids:
for employee_id in self.env['hr.employee'].browse(employee_ids):
planning_ids = self.env['planning.slot'].search([('resource_id', '=', employee_id.resource_id.id)])
for planning_id in planning_ids:
start_date = planning_id.start_datetime.date()
@@ -76,7 +76,7 @@ class YuthonRunPlanning(models.Model):
other_resource_id = other.employee_id.resource_id
regular_holiday = other.regular_holidays
weekday_mapping = {
'one': 6, 'two': 0, 'three': 1, 'four': 2, 'five': 3, 'six': 4, 'seven': 5
'one': 7, 'two': 1, 'three': 2, 'four': 3, 'five': 4, 'six': 5, 'seven': 6
}
weekday_number = weekday_mapping.get(regular_holiday)
other_data[other_resource_id.id] = weekday_number
@@ -88,8 +88,8 @@ class YuthonRunPlanning(models.Model):
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),
'start_datetime': datetime(current_date.year, current_date.month, current_date.day,start_time) + timedelta(hours=16)- timedelta(days=1),
'end_datetime': datetime(current_date.year, current_date.month, current_date.day,end_time) + timedelta(hours=16)- timedelta(days=1),
'role_id': role_a.id,
'allocated_hours': 8,
})
@@ -25,7 +25,7 @@
<field name="illustrate"/>
<field name="department_id"/>
</group>
<group string="运行班安排">
<group string="运行班排班">
<field name="engineering_run_ids" string=" ">
<tree editable="bottom">
<field name="engineering_planning_id" column_invisible="1"/>
@@ -73,7 +73,7 @@
<field name="illustrate"/>
<field name="department_id"/>
</group>
<group string="综合班安排">
<group string="综合班排班">
<field name="all_run_ids" string=" ">
<tree editable="bottom">
<field name="engineering_planning_id" column_invisible="1"/>
@@ -111,7 +111,7 @@
<field name="illustrate"/>
<field name="department_id"/>
</group>
<group string="高压班安排">
<group string="高压班排班">
<field name="high_run_ids" string=" ">
<tree editable="bottom">
<field name="engineering_planning_id" column_invisible="1"/>
@@ -130,7 +130,7 @@
<field name="view_mode">tree,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_id.name', '=', '运行班')]</field>
@@ -139,7 +139,7 @@
(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="name">综合部排班</field>
<field name="res_model">yuthon.run.planning</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('department_id.name', '=', '综合班')]</field>
@@ -148,7 +148,7 @@
(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="name">高压部排班</field>
<field name="res_model">yuthon.run.planning</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('department_id.name', '=', '高压班')]</field>
+5 -5
View File
@@ -175,15 +175,15 @@
name="粮库值班管理"
parent="hr_attendance_root_board"
sequence="9"/>
<menuitem id="menu_hr_attendance_duty_summary_board"
name="值班安排"
parent="menu_hr_attendance_duty_summary_menu_board"
action="yuthon_duty_plan.view_yuthon_duty_arrangement_action"
sequence="1"/>
<menuitem id="menu_hr_attendance_duty_plan_board"
name="值班计划"
parent="menu_hr_attendance_duty_summary_menu_board"
action="yuthon_duty_plan.view_yuthon_duty_plan_action"
sequence="1"/>
<menuitem id="menu_hr_attendance_duty_summary_board"
name="值班排班"
parent="menu_hr_attendance_duty_summary_menu_board"
action="yuthon_duty_plan.view_yuthon_duty_arrangement_action"
sequence="3"/>
<menuitem id="menu_hr_attendance_duty_record_board"
name="值班记录"