From 2ae9ed2883ff1cc7ed6214a738ea2f134a5ac7ff Mon Sep 17 00:00:00 2001 From: zhouzhou <123@qq.com> Date: Wed, 11 Dec 2024 14:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_duty_plan/__manifest__.py | 7 ------- yuthon_duty_plan/models/__init__.py | 6 ------ yuthon_duty_plan/security/ir.model.access.csv | 8 -------- yuthon_hr_attendance/__manifest__.py | 6 ++++++ yuthon_hr_attendance/models/__init__.py | 7 +++++++ .../models/yuthon_abnormal_approval.py | 0 .../models/yuthon_abnormal_setting.py | 0 .../models/yuthon_adjustments_approval.py | 0 .../models/yuthon_duty_plan.py | 10 ++++++++++ .../models/yuthon_duty_setting.py | 0 .../models/yuthon_shift_approval.py | 0 .../security/ir.model.access.csv | 10 +++++++++- .../views/yuthon_abnormal_approval_views.xml | 0 .../views/yuthon_abnormal_setting_views.xml | 0 .../views/yuthon_adjustments_approval_views.xml | 0 .../views/yuthon_duty_plan_views.xml | 6 +++--- .../views/yuthon_duty_setting_views.xml | 0 .../views/yuthon_shift_approval_views.xml | 0 yuthon_work_brand/__manifest__.py | 1 - yuthon_work_brand/views/attendance_menu.xml | 16 ++++++++-------- 20 files changed, 43 insertions(+), 34 deletions(-) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_abnormal_approval.py (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_abnormal_setting.py (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_adjustments_approval.py (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_duty_plan.py (88%) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_duty_setting.py (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/models/yuthon_shift_approval.py (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_abnormal_approval_views.xml (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_abnormal_setting_views.xml (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_adjustments_approval_views.xml (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_duty_plan_views.xml (95%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_duty_setting_views.xml (100%) rename {yuthon_duty_plan => yuthon_hr_attendance}/views/yuthon_shift_approval_views.xml (100%) diff --git a/yuthon_duty_plan/__manifest__.py b/yuthon_duty_plan/__manifest__.py index d817fbf93..a643e328a 100644 --- a/yuthon_duty_plan/__manifest__.py +++ b/yuthon_duty_plan/__manifest__.py @@ -18,13 +18,6 @@ 'views/yuthon_duty_arrangement_views.xml', 'views/yuthon_duty_summary_views.xml', - 'views/yuthon_duty_setting_views.xml', - 'views/yuthon_duty_plan_views.xml', - - 'views/yuthon_abnormal_approval_views.xml', - 'views/yuthon_abnormal_setting_views.xml', - 'views/yuthon_adjustments_approval_views.xml', - 'views/yuthon_shift_approval_views.xml', ], 'installable': True, 'application': True, diff --git a/yuthon_duty_plan/models/__init__.py b/yuthon_duty_plan/models/__init__.py index 9417273df..adb76409c 100644 --- a/yuthon_duty_plan/models/__init__.py +++ b/yuthon_duty_plan/models/__init__.py @@ -1,8 +1,2 @@ from . import yuthon_duty_arrangement -from . import yuthon_duty_plan -from . import yuthon_duty_setting from . import yuthon_duty_summary -from . import yuthon_adjustments_approval -from . import yuthon_abnormal_approval -from . import yuthon_abnormal_setting -from . import yuthon_shift_approval diff --git a/yuthon_duty_plan/security/ir.model.access.csv b/yuthon_duty_plan/security/ir.model.access.csv index d0c93064b..2e191cad7 100644 --- a/yuthon_duty_plan/security/ir.model.access.csv +++ b/yuthon_duty_plan/security/ir.model.access.csv @@ -1,11 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_yuthon_duty_arrangement,yuthon.duty.arrangement,model_yuthon_duty_arrangement,base.group_user,1,1,1,1 -access_yuthon_duty_plan,yuthon.duty.plan,model_yuthon_duty_plan,base.group_user,1,1,1,1 -access_duty_plan_line,duty.plan.line,model_duty_plan_line,base.group_user,1,1,1,1 -access_yuthon_duty_class_setting,yuthon.duty.class.setting,model_yuthon_duty_class_setting,base.group_user,1,1,1,1 access_yuthon_duty_summary,yuthon.duty.summary,model_yuthon_duty_summary,base.group_user,1,1,1,1 - -access_yuthon_adjustments_approval,yuthon.adjustments.approval,model_yuthon_adjustments_approval,base.group_user,1,1,1,1 -access_yuthon_abnormal_approval,yuthon.abnormal.approval,model_yuthon_abnormal_approval,base.group_user,1,1,1,1 -access_yuthon_abnormal_setting,yuthon.abnormal.setting,model_yuthon_abnormal_setting,base.group_user,1,1,1,1 -access_yuthon_shift_approval,yuthon.shift.approval,model_yuthon_shift_approval,base.group_user,1,1,1, \ No newline at end of file diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index c2372acc9..103c33f62 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -36,6 +36,12 @@ 'views/card_approval.xml', 'views/attendance_scheme.xml', 'views/duty_approval.xml', + 'views/yuthon_duty_setting_views.xml', + 'views/yuthon_duty_plan_views.xml', + 'views/yuthon_abnormal_approval_views.xml', + 'views/yuthon_abnormal_setting_views.xml', + 'views/yuthon_adjustments_approval_views.xml', + 'views/yuthon_shift_approval_views.xml', 'views/all_attendance_menu.xml', ], diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 18d4d1268..22047bfba 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -15,6 +15,13 @@ from . import yuthon_shift_planning from . import yuthon_run_planning from . import duty_approval from . import yuthon_customer_approval +from . import yuthon_duty_plan +from . import yuthon_duty_setting +from . import yuthon_adjustments_approval +from . import yuthon_abnormal_approval +from . import yuthon_abnormal_setting +from . import yuthon_shift_approval + # from odoo.tools import SQL diff --git a/yuthon_duty_plan/models/yuthon_abnormal_approval.py b/yuthon_hr_attendance/models/yuthon_abnormal_approval.py similarity index 100% rename from yuthon_duty_plan/models/yuthon_abnormal_approval.py rename to yuthon_hr_attendance/models/yuthon_abnormal_approval.py diff --git a/yuthon_duty_plan/models/yuthon_abnormal_setting.py b/yuthon_hr_attendance/models/yuthon_abnormal_setting.py similarity index 100% rename from yuthon_duty_plan/models/yuthon_abnormal_setting.py rename to yuthon_hr_attendance/models/yuthon_abnormal_setting.py diff --git a/yuthon_duty_plan/models/yuthon_adjustments_approval.py b/yuthon_hr_attendance/models/yuthon_adjustments_approval.py similarity index 100% rename from yuthon_duty_plan/models/yuthon_adjustments_approval.py rename to yuthon_hr_attendance/models/yuthon_adjustments_approval.py diff --git a/yuthon_duty_plan/models/yuthon_duty_plan.py b/yuthon_hr_attendance/models/yuthon_duty_plan.py similarity index 88% rename from yuthon_duty_plan/models/yuthon_duty_plan.py rename to yuthon_hr_attendance/models/yuthon_duty_plan.py index 122e0e3dd..702839cd1 100644 --- a/yuthon_duty_plan/models/yuthon_duty_plan.py +++ b/yuthon_hr_attendance/models/yuthon_duty_plan.py @@ -17,6 +17,7 @@ class YuthonDutyPlan(models.Model): def auto_duty_plan(self): 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)]) today = datetime.today().date() first_day_of_month = today.replace(day=1) if today.month < 12: @@ -30,6 +31,15 @@ class YuthonDutyPlan(models.Model): while current_date <= last_day_of_month: self.create_planning_slot(employee, role_a, role_template_a, current_date) current_date += timedelta(days=1) + + current_date = first_day_of_month + for line in self.plan_line_ids.sorted('sequence'): + for employee in line.employee_ids: + + self.create_planning_slot(employee, role_a, role_template_b, current_date) + current_date += timedelta(days=1) + + return { 'type': 'ir.actions.client', 'tag': 'display_notification', diff --git a/yuthon_duty_plan/models/yuthon_duty_setting.py b/yuthon_hr_attendance/models/yuthon_duty_setting.py similarity index 100% rename from yuthon_duty_plan/models/yuthon_duty_setting.py rename to yuthon_hr_attendance/models/yuthon_duty_setting.py diff --git a/yuthon_duty_plan/models/yuthon_shift_approval.py b/yuthon_hr_attendance/models/yuthon_shift_approval.py similarity index 100% rename from yuthon_duty_plan/models/yuthon_shift_approval.py rename to yuthon_hr_attendance/models/yuthon_shift_approval.py diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index 38184069e..672fa4ef2 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -22,4 +22,12 @@ access_yuthon_all_run_line,all.run.line,model_yuthon_all_run_line,base.group_use 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_noon_line,shift.ever.noon.line,model_yuthon_shift_ever_noon_line,base.group_user,1,1,1,1 -access_yuthon_customer_approval,yuthon.customer.approval,model_yuthon_customer_approval,base.group_user,1,1,1,1 \ No newline at end of file +access_yuthon_customer_approval,yuthon.customer.approval,model_yuthon_customer_approval,base.group_user,1,1,1,1 + +access_yuthon_duty_plan,yuthon.duty.plan,model_yuthon_duty_plan,base.group_user,1,1,1,1 +access_duty_plan_line,duty.plan.line,model_duty_plan_line,base.group_user,1,1,1,1 +access_yuthon_duty_class_setting,yuthon.duty.class.setting,model_yuthon_duty_class_setting,base.group_user,1,1,1,1 +access_yuthon_adjustments_approval,yuthon.adjustments.approval,model_yuthon_adjustments_approval,base.group_user,1,1,1,1 +access_yuthon_abnormal_approval,yuthon.abnormal.approval,model_yuthon_abnormal_approval,base.group_user,1,1,1,1 +access_yuthon_abnormal_setting,yuthon.abnormal.setting,model_yuthon_abnormal_setting,base.group_user,1,1,1,1 +access_yuthon_shift_approval,yuthon.shift.approval,model_yuthon_shift_approval,base.group_user,1,1,1, \ No newline at end of file diff --git a/yuthon_duty_plan/views/yuthon_abnormal_approval_views.xml b/yuthon_hr_attendance/views/yuthon_abnormal_approval_views.xml similarity index 100% rename from yuthon_duty_plan/views/yuthon_abnormal_approval_views.xml rename to yuthon_hr_attendance/views/yuthon_abnormal_approval_views.xml diff --git a/yuthon_duty_plan/views/yuthon_abnormal_setting_views.xml b/yuthon_hr_attendance/views/yuthon_abnormal_setting_views.xml similarity index 100% rename from yuthon_duty_plan/views/yuthon_abnormal_setting_views.xml rename to yuthon_hr_attendance/views/yuthon_abnormal_setting_views.xml diff --git a/yuthon_duty_plan/views/yuthon_adjustments_approval_views.xml b/yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml similarity index 100% rename from yuthon_duty_plan/views/yuthon_adjustments_approval_views.xml rename to yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml diff --git a/yuthon_duty_plan/views/yuthon_duty_plan_views.xml b/yuthon_hr_attendance/views/yuthon_duty_plan_views.xml similarity index 95% rename from yuthon_duty_plan/views/yuthon_duty_plan_views.xml rename to yuthon_hr_attendance/views/yuthon_duty_plan_views.xml index 8f127468a..576f4a585 100644 --- a/yuthon_duty_plan/views/yuthon_duty_plan_views.xml +++ b/yuthon_hr_attendance/views/yuthon_duty_plan_views.xml @@ -4,7 +4,7 @@ yuthon.duty.plan.tree yuthon.duty.plan - + @@ -16,7 +16,7 @@ yuthon.duty.plan.form yuthon.duty.plan -
+
@@ -57,7 +57,7 @@ - 值班计划 + 排班安排 yuthon.duty.plan tree,form diff --git a/yuthon_duty_plan/views/yuthon_duty_setting_views.xml b/yuthon_hr_attendance/views/yuthon_duty_setting_views.xml similarity index 100% rename from yuthon_duty_plan/views/yuthon_duty_setting_views.xml rename to yuthon_hr_attendance/views/yuthon_duty_setting_views.xml diff --git a/yuthon_duty_plan/views/yuthon_shift_approval_views.xml b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml similarity index 100% rename from yuthon_duty_plan/views/yuthon_shift_approval_views.xml rename to yuthon_hr_attendance/views/yuthon_shift_approval_views.xml diff --git a/yuthon_work_brand/__manifest__.py b/yuthon_work_brand/__manifest__.py index 96ca82207..b6d93b611 100644 --- a/yuthon_work_brand/__manifest__.py +++ b/yuthon_work_brand/__manifest__.py @@ -10,7 +10,6 @@ 'payment', 'purchase', 'stock', 'resource', 'yuthon_hr_employee_approval', 'planning', 'ks_dashboard_ninja', - 'yuthon_duty_plan', ], 'data': [ 'security/ir.model.access.csv', diff --git a/yuthon_work_brand/views/attendance_menu.xml b/yuthon_work_brand/views/attendance_menu.xml index 6645d4b59..c26d9239e 100644 --- a/yuthon_work_brand/views/attendance_menu.xml +++ b/yuthon_work_brand/views/attendance_menu.xml @@ -178,7 +178,7 @@ - + + action="yuthon_hr_attendance.view_yuthon_adjustments_approval_action"/> + action="yuthon_hr_attendance.view_yuthon_abnormal_approval_action"/> + action="yuthon_hr_attendance.view_yuthon_shift_approval_action"/> - + + action="yuthon_hr_attendance.action_yuthon_duty_class_setting"/> + action="yuthon_hr_attendance.view_yuthon_abnormal_setting_action"/>