From 005111da25c9080589d43fbe994b721ac6386745 Mon Sep 17 00:00:00 2001
From: zhouzhou <123@qq.com>
Date: Tue, 22 Oct 2024 22:04:48 +0800
Subject: [PATCH 1/2] =?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
---
.../models/holidays_approval.py | 3 +-
yuthon_performance/__manifest__.py | 1 +
.../data/library_changes_data.xml | 16 +++++
.../models/yuthon_Index_approval.py | 3 +-
.../models/yuthon_Index_management.py | 2 +-
.../models/yuthon_assessment_tasks.py | 4 ++
.../models/yuthon_duty_management.py | 59 +++++++++++--------
.../models/yuthon_employee_approval.py | 3 +-
.../views/yuthon_Index_approval.xml | 5 +-
.../views/yuthon_Index_management.xml | 16 ++---
.../views/yuthon_assessment_tasks.xml | 3 +-
.../views/yuthon_duty_management.xml | 9 +--
.../views/yuthon_employee_approval.xml | 5 +-
.../views/yuthon_performance_menus.xml | 2 +-
.../wizard/yuthon_assessment_tasks_wizard.py | 3 +-
.../yuthon_assessment_tasks_wizard_views.xml | 5 +-
16 files changed, 89 insertions(+), 50 deletions(-)
create mode 100644 yuthon_performance/data/library_changes_data.xml
diff --git a/yuthon_hr_attendance/models/holidays_approval.py b/yuthon_hr_attendance/models/holidays_approval.py
index ceefd43bc..07b36fbd5 100644
--- a/yuthon_hr_attendance/models/holidays_approval.py
+++ b/yuthon_hr_attendance/models/holidays_approval.py
@@ -35,8 +35,7 @@ class HolidaysApprovalsLine(models.Model):
name = fields.Char(string="请假事由")
approvals_id = fields.Many2one('holidays.approval', string="管理请假审批")
vacation_category = fields.Many2one('holiday.type.setting', string="休假类别")
- leave_type_id = fields.Many2one('hr.leave.type', string="请假类型",
- domain="[('vacation_type_id', '=', vacation_category)]")
+ leave_type_id = fields.Many2one('hr.leave.type', string="请假类型",)
days_available = fields.Float(string="可用天数", store=True)
applicants = fields.Selection([('hour', '按小时'), ('day', '天'), ('half_day', '半天')], string="申请单位",
store=True)
diff --git a/yuthon_performance/__manifest__.py b/yuthon_performance/__manifest__.py
index 682f051a5..023db8ccd 100644
--- a/yuthon_performance/__manifest__.py
+++ b/yuthon_performance/__manifest__.py
@@ -13,6 +13,7 @@
'depends': ['hr', 'soong_workflow',],
'data': [
'security/ir.model.access.csv',
+ 'data/library_changes_data.xml',
'views/yuthon_Index_management.xml',
'views/yuthon_duty_management.xml',
'views/yuthon_performance_menus.xml',
diff --git a/yuthon_performance/data/library_changes_data.xml b/yuthon_performance/data/library_changes_data.xml
new file mode 100644
index 000000000..9ba277cda
--- /dev/null
+++ b/yuthon_performance/data/library_changes_data.xml
@@ -0,0 +1,16 @@
+
+
+
+ 组织指标库-编号
+ library_changes_organize_code
+ ZZ%(y)s%(month)s%(day)s
+ 3
+
+
+
+ 个人指标库-编号
+ library_changes_personal_code
+ GR%(y)s%(month)s%(day)s
+ 3
+
+
\ No newline at end of file
diff --git a/yuthon_performance/models/yuthon_Index_approval.py b/yuthon_performance/models/yuthon_Index_approval.py
index 5149e2b30..12cdd88e3 100644
--- a/yuthon_performance/models/yuthon_Index_approval.py
+++ b/yuthon_performance/models/yuthon_Index_approval.py
@@ -9,7 +9,8 @@ class YuthonIndexApproval(models.Model):
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
job_id = fields.Many2one('hr.job', string="岗位")
reason_text = fields.Html(string='申请事由')
-
+ code = fields.Char(string="编号",
+ default=lambda self: self.env['ir.sequence'].next_by_code('library_changes_organize_code'))
change_index_library_ids = fields.One2many("yuthon.index.management",'change_index_library_id',string="组织指标库变更明细")
new_index_library_ids = fields.One2many("new.index.management.line",'new_change_index_library_id',string="新组织指标库变更明细")
diff --git a/yuthon_performance/models/yuthon_Index_management.py b/yuthon_performance/models/yuthon_Index_management.py
index 3caaa39d4..0c81c04e6 100644
--- a/yuthon_performance/models/yuthon_Index_management.py
+++ b/yuthon_performance/models/yuthon_Index_management.py
@@ -4,8 +4,8 @@ from odoo import models, fields, api, exceptions, _
class YuthonIndexManagement(models.Model):
_name = 'yuthon.index.management'
_description = "组织绩效标准库"
+ _rec_name = 'index_name'
- name = fields.Char('指标库', required=True)
dimension = fields.Char('维度', required=True)
development_goals = fields.Char('发展目标', required=True)
index_name = fields.Char('指标名称', required=True)
diff --git a/yuthon_performance/models/yuthon_assessment_tasks.py b/yuthon_performance/models/yuthon_assessment_tasks.py
index 08a912302..3b94184be 100644
--- a/yuthon_performance/models/yuthon_assessment_tasks.py
+++ b/yuthon_performance/models/yuthon_assessment_tasks.py
@@ -66,3 +66,7 @@ class YuthonAssessmentTasksLines(models.Model):
examiners = fields.Many2one('hr.employee',string='考核人员')
be_examiners = fields.Many2one('hr.employee',string='被考核人员')
assessment_status = fields.Selection([('assessment', '已考核'), ('no_assessment', '未考核')], string='考核状态')
+
+
+ def put_retake_the_exam(self):
+ pass
diff --git a/yuthon_performance/models/yuthon_duty_management.py b/yuthon_performance/models/yuthon_duty_management.py
index cbf14257c..852411ff1 100644
--- a/yuthon_performance/models/yuthon_duty_management.py
+++ b/yuthon_performance/models/yuthon_duty_management.py
@@ -1,5 +1,5 @@
from odoo import models, fields, api, exceptions, _
-
+from datetime import datetime
class YuthonDutyManagement(models.Model):
_name = 'yuthon.duty.management'
@@ -7,28 +7,27 @@ class YuthonDutyManagement(models.Model):
_rec_name = 'name'
name = fields.Char('标题')
- assessment_time = fields.Char('考核时间', required=True)
cycle = fields.Selection([('monthly', '月度'),
('quarter', '季度'),
('up_half', '上半年'),
('down_half', '下半年'),
- ('year', '年'), ], '周期', required=True)
+ ('year', '年度'), ], '周期', required=True)
department_id = fields.Many2one("hr.department", string="部门", required=True)
start_index_time = fields.Date('指标生效时间')
end_index_time = fields.Date('指标失效时间')
- assessment_department_id = fields.Many2one("hr.department", string="被考核部门")
+ users_role_ids = fields.Many2many('soong.user.role', string='被考核角色')
+ users_ids = fields.Many2many('hr.employee', string='被考核人员')
index_statu = fields.Selection([('work', '生效'), ('void', '作废')], '状态', required=True)
# 绩效考核
performance_kpi_ids = fields.One2many('yuthon.kpi.line', 'performance_kpi_id', string="KPI")
performance_gs_ids = fields.One2many('yuthon.gs.line', 'performance_gs_id', string="GS")
organization_ids = fields.One2many('yuthon.role.detail.lines', 'organization_id', string="考核角色")
@api.onchange('assessment_time', 'cycle', 'department_id')
- def _onchange_year_department(self):
- if self.cycle and self.department_id and self.assessment_time:
- cycle_dict = {'monthly': '月度', 'quarter': '季度', 'up_half': '上半年', 'down_half': '下半年',
- 'year': '年度'}
- cycle_display = cycle_dict.get(self.cycle, self.cycle)
- self.name = f"{self.assessment_time}{cycle_display}{self.department_id.name}绩效考核"
+ def _onchange_name(self):
+ cycle_dict = {'monthly': '月度', 'quarter': '季度', 'up_half': '上半年', 'down_half': '下半年', 'year': '年度'}
+ cycle_display = cycle_dict.get(self.cycle, self.cycle) if self.cycle else ''
+ department_name = self.department_id.name if self.department_id else ''
+ self.name = f"{self.assessment_time or ''}{cycle_display}{department_name}绩效考核"
@api.model_create_multi
def create(self, vals_list):
@@ -41,7 +40,19 @@ class YuthonDutyManagement(models.Model):
'assessment_time': performance.assessment_time,
'performance_type':'organize'
})
- return performance_records
+ return performance_records
+
+ @api.model
+ def _get_assessment_time_options(self):
+ current_year = int(self.assessment_time) if self.assessment_time else datetime.now().year
+ return [(str(year), str(year)) for year in range(current_year, current_year + 2)]
+
+ assessment_time = fields.Selection(
+ selection='_get_assessment_time_options',
+ string='考核时间',
+ required=True,
+ default=lambda self: str(datetime.now().year)
+ )
@api.model
def write(self, vals):
@@ -57,30 +68,28 @@ class YuthonDutyManagement(models.Model):
})
return result
+ @api.depends('users_role_ids')
+ def _compute_users_role_ids(self):
+ if self.users_role_ids:
+ for user_id in self.users_role_ids:
+ user_role_data = self.env['hr.employee'].search(
+ ['|', ('user_role_id', '=', user_id.id.origin), ('user_role_ids', '=', user_id.id.origin)])
+ users_role_list = [ro.user_id.id for ro in user_role_data]
+ self.users_ids = [(6, 0, users_role_list)]
+
class YuthonKpiLine(models.Model):
_name = 'yuthon.kpi.line'
_description = "KPI明细行"
-
+ _rec_name = ''
# 链接部门责任书和变更菜单
performance_kpi_id = fields.Many2one('yuthon.duty.management', string="KPI")
change_duty_kpi_id = fields.Many2one('yuthon.duty.approval', string="KPI变更明细")
#
# KPI
# 指标名称
- index_name_id = fields.Many2one('yuthon.index.management')
- duty_index_name = fields.Char(related='index_name_id.index_name', string='指标名称', store=True)#
+ duty_index_name = fields.Many2one('yuthon.index.management',string='指标名称', store=True)#
+ duty_index_definition = fields.Text(related='duty_index_name.index_definition', string="指标定义")
- index_definition_id = fields.Many2one('yuthon.index.management')
- duty_index_definition = fields.Text(related='index_definition_id.index_definition', string="指标定义")
-#
-# index_id = fields.Many2one('yuthon.index.management')
-# duty_index_type = fields.Selection(related='index_id.compute_type', string='计算类别', store=True)
-#
-# in_charge_role_id = fields.Many2one('yuthon.index.management')
-# in_charge_role = fields.Many2one('soong.user.role', related='in_charge_role_id.in_charge_role', string='角色')
-#
-# duty_employee_id = fields.Many2one('yuthon.index.management')
-# employee_id = fields.Many2one('hr.employee', related='duty_employee_id.employee_id', string="员工", store=True)
#半年考核任务
half_floor_limit = fields.Float('底限值')
half_benchmark_value = fields.Float('基准值')
diff --git a/yuthon_performance/models/yuthon_employee_approval.py b/yuthon_performance/models/yuthon_employee_approval.py
index b0cdf8857..e34fb085f 100644
--- a/yuthon_performance/models/yuthon_employee_approval.py
+++ b/yuthon_performance/models/yuthon_employee_approval.py
@@ -11,10 +11,11 @@ class YuthonEmployeeApproval(models.Model):
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
job_id = fields.Many2one('hr.job', string="岗位")
reason_text = fields.Html(string='申请事由')
+ code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('library_changes_personal_code'))
change_employee_library_ids = fields.One2many("yuthon.index.employee",'change_employee_library_id',string="员工指标库库变更明细")
new_change_employee_library_ids = fields.One2many("new.employee.library.line",'new_change_employee_library_id',string="新员工指标库变更明细")
-
+ users_role_ids = fields.Many2many('soong.user.role', string='被考核角色')
@api.onchange('change_employee_library_ids')
def _onchange_change_employee_library_ids(self):
diff --git a/yuthon_performance/views/yuthon_Index_approval.xml b/yuthon_performance/views/yuthon_Index_approval.xml
index ebc95cb32..3d09ba7ef 100644
--- a/yuthon_performance/views/yuthon_Index_approval.xml
+++ b/yuthon_performance/views/yuthon_Index_approval.xml
@@ -27,10 +27,11 @@
-
+
+
@@ -51,7 +52,7 @@
-
+
diff --git a/yuthon_performance/views/yuthon_Index_management.xml b/yuthon_performance/views/yuthon_Index_management.xml
index 001ddc713..0a5f886c4 100644
--- a/yuthon_performance/views/yuthon_Index_management.xml
+++ b/yuthon_performance/views/yuthon_Index_management.xml
@@ -32,17 +32,18 @@
diff --git a/yuthon_performance/views/yuthon_duty_management.xml b/yuthon_performance/views/yuthon_duty_management.xml
index f7f0ceea3..f810f3d26 100644
--- a/yuthon_performance/views/yuthon_duty_management.xml
+++ b/yuthon_performance/views/yuthon_duty_management.xml
@@ -32,7 +32,8 @@
-
+
+
@@ -44,8 +45,8 @@
-
-
+
+
@@ -68,7 +69,7 @@
-
+
diff --git a/yuthon_performance/views/yuthon_employee_approval.xml b/yuthon_performance/views/yuthon_employee_approval.xml
index 5a6c6322c..e0bc99bbe 100644
--- a/yuthon_performance/views/yuthon_employee_approval.xml
+++ b/yuthon_performance/views/yuthon_employee_approval.xml
@@ -27,10 +27,11 @@
-
+
+
@@ -45,7 +46,7 @@
-
+
diff --git a/yuthon_performance/views/yuthon_performance_menus.xml b/yuthon_performance/views/yuthon_performance_menus.xml
index e78421f3e..dd3b378b6 100644
--- a/yuthon_performance/views/yuthon_performance_menus.xml
+++ b/yuthon_performance/views/yuthon_performance_menus.xml
@@ -10,7 +10,7 @@
sequence="1"/>