From 2eb2f2c67ffa69921ec313f79da17032e4aa3ad0 Mon Sep 17 00:00:00 2001
From: zhouzhou <123@qq.com>
Date: Tue, 22 Oct 2024 18:06:04 +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_issue/models/issue_library.py | 2 +-
.../models/yuthon_Index_approval.py | 59 +++++++++++++++++++
.../models/yuthon_Index_management.py | 30 ++++------
.../models/yuthon_employee_approval.py | 31 ++++++++++
.../security/ir.model.access.csv | 4 +-
.../views/yuthon_Index_approval.xml | 28 ++++++++-
.../views/yuthon_employee_approval.xml | 25 ++++++--
yuthon_work_brand/views/hr_menus.xml | 9 ++-
8 files changed, 158 insertions(+), 30 deletions(-)
diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py
index 293cd21b2..e14bcdfa6 100644
--- a/yuthon_issue/models/issue_library.py
+++ b/yuthon_issue/models/issue_library.py
@@ -60,7 +60,7 @@ class IssueLibrary(models.Model):
for issue_record in issue_active_ids:
issue_record.write({"state": "approval"})
issue_decision_lines.append((0, 0, {
- 'issue_approval_id': issue_record.id,
+ 'issue_library_id': issue_record.id,
'approval_decision_sequence': issue_record.approval_decision_sequence,
'is_party':issue_record.is_party,
'is_class': issue_record.is_class,
diff --git a/yuthon_performance/models/yuthon_Index_approval.py b/yuthon_performance/models/yuthon_Index_approval.py
index ce0287aaf..5149e2b30 100644
--- a/yuthon_performance/models/yuthon_Index_approval.py
+++ b/yuthon_performance/models/yuthon_Index_approval.py
@@ -3,6 +3,7 @@ class YuthonIndexApproval(models.Model):
_name = 'yuthon.index.approval'
_description = "组织指标库变更管理"
_rec_name = 'name'
+ _inherit = 'soong.workflow.mixin'
name = fields.Char('标题')
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
@@ -10,3 +11,61 @@ class YuthonIndexApproval(models.Model):
reason_text = fields.Html(string='申请事由')
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="新组织指标库变更明细")
+
+ @api.onchange('change_index_library_ids')
+ def onchange_change_index_library_ids(self):
+ new_lines = []
+ for old in self:
+ for new in old.change_index_library_ids:
+ new_lines.append((0, 0, {
+ 'new_dimension': new.dimension,
+ 'new_development_goals': new.development_goals,
+ 'new_index_name': new.index_name,
+ 'new_index_definition': new.index_definition,
+ 'new_index_type': new.index_type,
+ 'new_index_compute': new.index_compute,
+ 'new_compute_type': new.compute_type,
+ 'new_check_norm': new.check_norm,
+ 'new_department_ids': new.department_ids,
+ 'new_in_charge_role_ids': new.in_charge_role_ids,
+ 'new_employee_id': new.employee_id,
+ 'new_start_index_time': new.start_index_time,
+ 'new_end_index_time': new.end_index_time,
+ 'new_unit_compute': new.unit_compute,
+ 'new_weight': new.weight,
+ 'new_compute_method': new.compute_method,
+ 'new_compute_act': new.compute_act,
+ }))
+ self.new_index_library_ids = new_lines
+
+
+class NewIndexManagement(models.Model):
+ _name = 'new.index.management.line'
+ _description = "新组织指标库变更明细"
+
+
+ new_change_index_library_id = fields.Many2one('yuthon.index.approval',string="关联组织绩效指标库变更")
+ new_dimension = fields.Char('维度', required=True)
+ new_development_goals = fields.Char('发展目标', required=True)
+ new_index_name = fields.Char('指标名称', required=True)
+ new_index_definition = fields.Text('指标定义', required=True)
+ new_index_type = fields.Selection([('kpi', 'KPI'),
+ ('gs', 'GS'),
+ ('refused_index', '否决指标'), ], '指标类别')
+ new_index_compute = fields.Char('指标计算公式', required=True)
+ new_compute_type = fields.Selection([('bad_index', '反向指标'),
+ ('good_index', '正向指标'),
+ ('two_index', '双向指标'), ], '计算类别')
+ new_check_norm = fields.Char('考核标准', required=True)
+ new_department_ids = fields.Many2many("hr.department", string="指标来源", required=True)
+ new_in_charge_role_ids = fields.Many2many('soong.user.role', string='角色')
+ new_employee_id = fields.Many2one('hr.employee', string="人员")
+ new_start_index_time = fields.Date(string='生效时间', required=True)
+ new_end_index_time = fields.Date(string='失效时间')
+ new_unit_compute = fields.Char('计算单位')
+ new_weight = fields.Char(string="权重%")
+ new_compute_method = fields.Char(string="计算方法")
+ new_compute_act = fields.Char(string="计划安排及具体措施/行动")
+
+
diff --git a/yuthon_performance/models/yuthon_Index_management.py b/yuthon_performance/models/yuthon_Index_management.py
index a4510b208..3caaa39d4 100644
--- a/yuthon_performance/models/yuthon_Index_management.py
+++ b/yuthon_performance/models/yuthon_Index_management.py
@@ -35,8 +35,7 @@ class YuthonIndexManagement(models.Model):
index_duty_approval_id = fields.Many2one('yuthon.duty.approval', string="部门责任变更明细")
def put_adjustment_approval(self):
- index_applicant_ids = self.env["yuthon.index.management"].browse(
- self._context.get('active_ids', self._context.get('active_id')))
+ index_applicant_ids = self.env["yuthon.index.management"].browse(self._context.get('active_ids', self._context.get('active_id')))
index_applicant_data = [(6, 0,index_applicant_ids.ids)]
form_id = self.env.ref('yuthon_performance.yuthon_index_approval_form').id
return {
@@ -45,23 +44,16 @@ class YuthonIndexManagement(models.Model):
'view_mode': 'form',
'res_model': 'yuthon.index.approval',
'views': [(form_id, 'form')],
- 'context': {'default_change_index_library_ids': index_applicant_data}
+ 'context': {'default_change_index_library_ids': index_applicant_data,}
}
+
+ def open_record(self):
+ return {
+ "type": "ir.actions.act_window",
+ "res_model": 'yuthon.index.management',
+ "res_id": self.id,
+ "name":"组织库详情",
+ "view_mode": "form",
+ }
def put_assessment_tasks_approval(self):
pass
- # index_applicant_ids = self.env["yuthon.index.management"].browse(
- # self._context.get('active_ids', self._context.get('active_id')))
- # index_applicant_data = [(6, 0,index_applicant_ids.ids)]
- # form_id = self.env.ref('yuthon_performance.yuthon_duty_management_form').id
- # if self.index_type == 'kpi':
- # context = {'default_performance_kpi_ids': index_applicant_data}
- # else:
- # context = {'default_performance_gs_ids': index_applicant_data}
- # return{
- # 'name': '计划安排及具体措施/行动',
- # 'type': 'ir.actions.act_window',
- # 'view_mode': 'form',
- # 'res_model': 'yuthon.duty.management',
- # 'views': [(form_id, 'form')],
- # 'context': context
- # }
diff --git a/yuthon_performance/models/yuthon_employee_approval.py b/yuthon_performance/models/yuthon_employee_approval.py
index ace8fcbe2..b0cdf8857 100644
--- a/yuthon_performance/models/yuthon_employee_approval.py
+++ b/yuthon_performance/models/yuthon_employee_approval.py
@@ -5,6 +5,7 @@ class YuthonEmployeeApproval(models.Model):
_name = 'yuthon.employee.approval'
_description = "员工指标库变更管理"
_rec_name = 'name'
+ _inherit = 'soong.workflow.mixin'
name = fields.Char('标题')
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
@@ -12,3 +13,33 @@ class YuthonEmployeeApproval(models.Model):
reason_text = fields.Html(string='申请事由')
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="新员工指标库变更明细")
+
+
+ @api.onchange('change_employee_library_ids')
+ def _onchange_change_employee_library_ids(self):
+ new_lines = []
+ for old in self:
+ for new in old.change_employee_library_ids:
+ new_lines.append((0, 0,{
+ 'new_users_role_ids': new.users_role_ids,
+ 'new_department_ids': new.department_ids,
+ 'new_employee_ids': new.employee_ids,
+ 'new_dimension': new.dimension,
+ 'new_start_index_time':new.start_index_time,
+ 'new_end_index_time': new.end_index_time,
+ }))
+ self.new_change_employee_library_ids = new_lines
+
+class NewEmployeeLibraryLine(models.Model):
+ _name = 'new.employee.library.line'
+ _description = "新员工指标库变更明细"
+
+
+ new_change_employee_library_id = fields.Many2one('yuthon.employee.approval', string='关联员工指标库变更')
+ new_users_role_ids = fields.Many2many('soong.user.role', string='角色')
+ new_department_ids = fields.Many2many('hr.department', string='部门')
+ new_employee_ids = fields.Many2many('hr.employee', string='人员')
+ new_dimension = fields.Char('评价维度', required=True)
+ new_start_index_time = fields.Datetime('开始时间', required=True)
+ new_end_index_time = fields.Datetime('结束时间', required=True)
diff --git a/yuthon_performance/security/ir.model.access.csv b/yuthon_performance/security/ir.model.access.csv
index 2eb953181..897ed19d6 100644
--- a/yuthon_performance/security/ir.model.access.csv
+++ b/yuthon_performance/security/ir.model.access.csv
@@ -21,4 +21,6 @@ access_yuthon_appraisal_line_detail,yuthon_appraisal_line_detail,model_yuthon_ap
access_yuthon_role_detail_lines,yuthon_role_detail_lines,model_yuthon_role_detail_lines,base.group_user,1,1,1,1
access_yuthon_assessment_tasks_lines,yuthon_assessment_tasks_lines,model_yuthon_assessment_tasks_lines,base.group_user,1,1,1,1
access_yuthon_assessment_tasks_wizard,yuthon_assessment_tasks_wizard,model_yuthon_assessment_tasks_wizard,base.group_user,1,1,1,1
-access_yuthon_yuthon_index_employee_line,yuthon_index_employee_line,model_yuthon_index_employee_line,base.group_user,1,1,1,1
\ No newline at end of file
+access_yuthon_index_employee_line,yuthon_index_employee_line,model_yuthon_index_employee_line,base.group_user,1,1,1,1
+access_new_index_management_line,new_index_management_line,model_new_index_management_line,base.group_user,1,1,1,1
+access_new_employee_library_line,new_employee_library_line,model_new_employee_library_line,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_performance/views/yuthon_Index_approval.xml b/yuthon_performance/views/yuthon_Index_approval.xml
index 1cecbba6e..ebc95cb32 100644
--- a/yuthon_performance/views/yuthon_Index_approval.xml
+++ b/yuthon_performance/views/yuthon_Index_approval.xml
@@ -34,9 +34,10 @@
-
-
-
+
+
+
+
@@ -50,8 +51,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_performance/views/yuthon_employee_approval.xml b/yuthon_performance/views/yuthon_employee_approval.xml
index f422c01cc..668c0a902 100644
--- a/yuthon_performance/views/yuthon_employee_approval.xml
+++ b/yuthon_performance/views/yuthon_employee_approval.xml
@@ -35,15 +35,32 @@
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index 1c9906e17..3e5e88c4c 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -681,13 +681,18 @@
parent="yuthon_performance_menu_config_root_board"
name="评分"
sequence="7"/>
-
+
+