diff --git a/yuthon_performance/models/yuthon_Index_approval.py b/yuthon_performance/models/yuthon_Index_approval.py index 296b489ba..017ccbf39 100644 --- a/yuthon_performance/models/yuthon_Index_approval.py +++ b/yuthon_performance/models/yuthon_Index_approval.py @@ -1,4 +1,6 @@ from odoo import models, fields, api, exceptions, _ + + class YuthonIndexApproval(models.Model): _name = 'yuthon.index.approval' _description = "组织指标库变更管理" @@ -7,6 +9,8 @@ class YuthonIndexApproval(models.Model): name = fields.Char('标题') creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now()) + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") job_id = fields.Many2one('hr.job', string="岗位") reason_text = fields.Html(string='申请事由') code = fields.Char(string="编号", @@ -29,7 +33,7 @@ class YuthonIndexApproval(models.Model): '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_in_charge_role_id': new.in_charge_role_id, 'new_employee_id': new.employee_id, 'new_start_index_time': new.start_index_time, 'new_end_index_time': new.end_index_time, @@ -58,8 +62,8 @@ class NewIndexManagement(models.Model): ('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_in_charge_role_id = fields.Many2one('soong.user.role', string='角色') + new_employee_ids = fields.Many2many('hr.employee', string="人员") new_start_index_time = fields.Date(string='生效时间', required=True) new_end_index_time = fields.Date(string='失效时间') new_unit_compute = fields.Char('计算单位') diff --git a/yuthon_performance/models/yuthon_Index_management.py b/yuthon_performance/models/yuthon_Index_management.py index a634adfe1..b1ed46bd2 100644 --- a/yuthon_performance/models/yuthon_Index_management.py +++ b/yuthon_performance/models/yuthon_Index_management.py @@ -21,8 +21,8 @@ class YuthonIndexManagement(models.Model): yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string="所属公司") department_ids = fields.Many2many("hr.department", string="指标来源") - in_charge_role_ids = fields.Many2many('soong.user.role', string='角色') - employee_id = fields.Many2one('hr.employee', string="人员") + in_charge_role_id = fields.Many2one('soong.user.role', string='角色') + employee_ids = fields.Many2many('hr.employee', string='人员范围') start_index_time = fields.Date(string='生效时间', default=fields.Date.today()) end_index_time = fields.Date(string='失效时间') unit_compute = fields.Char('计算单位') @@ -54,6 +54,7 @@ class YuthonIndexManagement(models.Model): "name":"组织库详情", "view_mode": "form", } + def put_assessment_tasks_approval(self): index_applicant_kpi = [] index_applicant_gs = [] diff --git a/yuthon_performance/models/yuthon_assessment_tasks.py b/yuthon_performance/models/yuthon_assessment_tasks.py index 3b94184be..55b984d01 100644 --- a/yuthon_performance/models/yuthon_assessment_tasks.py +++ b/yuthon_performance/models/yuthon_assessment_tasks.py @@ -6,6 +6,8 @@ class YuthonAssessmentTasks(models.Model): _description = '考核任务总汇' name = fields.Char(string='考核任务名称') + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") index_statu = fields.Selection([('work', '生效'), ('void', '作废')], string='状态') performance_type = fields.Selection([('organize', '组织绩效'), ('employs', '员工绩效')], stroing='考核类型') assessment_time = fields.Char(string='考核时间') diff --git a/yuthon_performance/models/yuthon_duty_management.py b/yuthon_performance/models/yuthon_duty_management.py index 840b67ded..18d0464fd 100644 --- a/yuthon_performance/models/yuthon_duty_management.py +++ b/yuthon_performance/models/yuthon_duty_management.py @@ -12,17 +12,19 @@ class YuthonDutyManagement(models.Model): ('up_half', '上半年'), ('down_half', '下半年'), ('year', '年度'), ], '周期', required=True) + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") department_id = fields.Many2one("hr.department", string="部门", required=True) start_index_time = fields.Date('指标生效时间') end_index_time = fields.Date('指标失效时间') users_role_ids = fields.Many2many('soong.user.role', string='被考核角色') users_ids = fields.Many2many('hr.employee', string='被考核人员') - index_statu = fields.Selection([('work', '生效'), ('void', '作废')], '状态', required=True) - + total_weights = fields.Float('总权重') # 绩效考核 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_name(self): cycle_dict = {'monthly': '月度', 'quarter': '季度', 'up_half': '上半年', 'down_half': '下半年', 'year': '年度'} @@ -79,35 +81,28 @@ class YuthonDutyManagement(models.Model): 'default_change_duty_gs_ids':[(6, 0, self.performance_gs_ids.ids)], }} + @api.onchange('performance_kpi_ids','performance_gs_ids') + def _onchange_performance_kpi_ids(self): + self.total_weights = 0.0 + for performance_kpi in self.performance_kpi_ids: + self.total_weights += performance_kpi.weight + for performance_gs in self.performance_gs_ids: + self.total_weights += performance_gs.weight class YuthonKpiLine(models.Model): _name = 'yuthon.kpi.line' _description = "KPI明细行" - performance_kpi_id = fields.Many2one('yuthon.duty.management', string="KPI") change_duty_kpi_id = fields.Many2one('yuthon.tissue.duty.approval', string="KPI变更明细") duty_index_name = fields.Many2one('yuthon.index.management',string='指标名称', store=True)# duty_index_definition = fields.Text(related='duty_index_name.index_definition', string="指标定义") - #半年考核任务 - half_floor_limit = fields.Float('底限值') - half_benchmark_value = fields.Float('基准值') - half_top_limit = fields.Float('努力制') - #年考核任务 - year_floor_limit = fields.Float('底限值1') - year_benchmark_value = fields.Float('基准值1') - year_top_limit = fields.Float('努力制1') - #月度考核任务 - month_floor_limit = fields.Float('底限值') - month_benchmark_value = fields.Float('基准值') - month_top_limit = fields.Float('努力制') - #季度考核任务 - quarter_floor_limit = fields.Float('底限值') - quarter_benchmark_value = fields.Float('基准值') - quarter_top_limit = fields.Float('努力制') - unit_compute = fields.Char('计算单位') - weight = fields.Char(string="权重%") + year_floor_limit = fields.Float('底限值T1') + unit_compute = fields.Char(string="单位") + year_benchmark_value = fields.Float('基准值T2') + year_top_limit = fields.Float('努力制T3') + weight = fields.Float(string="权重%") class YuthonGsLine(models.Model): _name = 'yuthon.gs.line' @@ -128,4 +123,5 @@ class YuthonGsLine(models.Model): node_target2 = fields.Char(string="节点目标") quality_objectives2 = fields.Char(string="质量目标") - weight = fields.Char(string="权重%") + weight = fields.Float(string="权重%") + diff --git a/yuthon_performance/models/yuthon_employee_appraisal.py b/yuthon_performance/models/yuthon_employee_appraisal.py index c49acd682..2b25abb2d 100644 --- a/yuthon_performance/models/yuthon_employee_appraisal.py +++ b/yuthon_performance/models/yuthon_employee_appraisal.py @@ -5,8 +5,9 @@ class YuthonEmployeeAppraisal(models.Model): _name = 'yuthon.employee.appraisal' _description = '员工绩效考核表' - name = fields.Char(string='名称') + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") apply = fields.Char(string='本表适用于') examiners = fields.Char(string='考核者') evaluation_time = fields.Date(string='评价时间') diff --git a/yuthon_performance/models/yuthon_employee_approval.py b/yuthon_performance/models/yuthon_employee_approval.py index 97e4f8472..d210a8c7a 100644 --- a/yuthon_performance/models/yuthon_employee_approval.py +++ b/yuthon_performance/models/yuthon_employee_approval.py @@ -10,6 +10,9 @@ class YuthonEmployeeApproval(models.Model): name = fields.Char('标题') users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") + dimension = fields.Char('评价维度', required=True) creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now()) job_id = fields.Many2one('hr.job', string="岗位") reason_text = fields.Html(string='申请事由') diff --git a/yuthon_performance/models/yuthon_employee_performance.py b/yuthon_performance/models/yuthon_employee_performance.py index 27a321972..748f9d860 100644 --- a/yuthon_performance/models/yuthon_employee_performance.py +++ b/yuthon_performance/models/yuthon_employee_performance.py @@ -1,12 +1,17 @@ from odoo import models, fields, api, exceptions, _ from odoo.exceptions import ValidationError, UserError +from odoo.odoo.tools.populate import compute + + class YuthonEmployeePerformance(models.Model): _name = 'yuthon.employee.performance' _description = '员工绩效(考核任务)' name = fields.Char('标题') assessment_time = fields.Char('考核时间', required=True) + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") cycle = fields.Selection([('monthly', '月度'), ('quarter', '季度'), ('up_half', '上半年'), @@ -46,7 +51,6 @@ class YuthonEmployeePerformance(models.Model): def write(self, vals): result = super().write(vals) if result: - # 只更新被修改的记录 for performance in self: tasks = self.env['yuthon.assessment.tasks'].search([('performance_id', '=', performance.id)]) tasks.write({ @@ -62,9 +66,18 @@ class YuthonRoleDetailLines(models.Model): role_id = fields.Many2one('yuthon.employee.performance', string="关联员工绩效(考核任务)") organization_id = fields.Many2one('yuthon.duty.management', string='组织绩效考核角色明细行') - job_id = fields.Many2one('hr.job', string="考核角色") - employee_id = fields.Many2one('hr.employee', string="人员") + in_charge_role_id = fields.Many2one('soong.user.role', string='角色') + employee_ids = fields.Many2many('hr.employee', string='人员', compute='_compute_employee_ids', store=True) weight = fields.Float(string="权重" ) + @api.depends('in_charge_role_id') + def _compute_employee_ids(self): + for record in self: + if record.in_charge_role_id: + employee_user_role_ids = self.env['hr.employee'].search( + ['|', ('user_role_id', '=', record.in_charge_role_id.id), + ('user_role_ids', 'in', record.in_charge_role_id.id)]) + record.employee_ids = employee_user_role_ids.ids + diff --git a/yuthon_performance/models/yuthon_grading_tasks.py b/yuthon_performance/models/yuthon_grading_tasks.py index d0bad02db..0acb72417 100644 --- a/yuthon_performance/models/yuthon_grading_tasks.py +++ b/yuthon_performance/models/yuthon_grading_tasks.py @@ -9,6 +9,8 @@ class YuthonGradingTasks(models.Model): department_id = fields.Many2one("hr.department", string="部门", required=True) index_time = fields.Date(string='时间') gs_ids = fields.One2many("yuthon.gs.detail.lines", "gs_id", string="GS评分表明细行") + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") diff --git a/yuthon_performance/models/yuthon_index_employee.py b/yuthon_performance/models/yuthon_index_employee.py index 7559cc8a8..08aba9826 100644 --- a/yuthon_performance/models/yuthon_index_employee.py +++ b/yuthon_performance/models/yuthon_index_employee.py @@ -10,6 +10,9 @@ class YuthonIndexEmployee(models.Model): users_role_ids = fields.Many2many('soong.user.role', string='角色') department_ids = fields.Many2many('hr.department', string='部门') employee_ids = fields.Many2many('hr.employee', string='人员') + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") + dimension = fields.Char('评价维度', required=True) name = fields.Char('评价维度', required=True) change_employee_library_id = fields.Many2one('yuthon.employee.approval', string='变更指标库') index_employee_ids = fields.One2many('yuthon.index.employee.line', 'index_employee_id', string='指标库明细') @@ -26,10 +29,10 @@ class YuthonIndexEmployee(models.Model): 'views': [(form_id,'form')], 'context': {'default_change_employee_library_ids':index_applicant_data }} + def put_assessment_tasks1_approval(self): pass - def open_record(self): return { "type": "ir.actions.act_window", diff --git a/yuthon_performance/models/yuthon_kpi_tasks.py b/yuthon_performance/models/yuthon_kpi_tasks.py index cf4f493f2..8c80c6a24 100644 --- a/yuthon_performance/models/yuthon_kpi_tasks.py +++ b/yuthon_performance/models/yuthon_kpi_tasks.py @@ -5,22 +5,18 @@ class YuthonKpiTasks(models.Model): _name = 'yuthon.kpi.tasks' _description = 'KPI ' - name = fields.Char(string='名称', required=True) department_id = fields.Many2one("hr.department", string="部门", required=True) index_time = fields.Date(string='时间') kpi_ids = fields.One2many('yuthon.kpi.detail.lines', 'kpi_id', string='KPI明细') - - - - + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") class YuthonKpiDetailLines(models.Model): _name = 'yuthon.kpi.detail.lines' _description = 'KPI明细行' - kpi_id = fields.Many2one('yuthon.kpi.tasks', string='KPI任务') weight = fields.Float(string='权重') kpl_name = fields.Char(string='kpl指标') diff --git a/yuthon_performance/models/yuthon_plan_management.py b/yuthon_performance/models/yuthon_plan_management.py index 53eb094f0..db042c2fc 100644 --- a/yuthon_performance/models/yuthon_plan_management.py +++ b/yuthon_performance/models/yuthon_plan_management.py @@ -11,9 +11,21 @@ class YuthonPlanManagement(models.Model): ('May','五月'), ('June','六月'), ('July','七月'), ('August','八月'), ('September','九月'), ('October','十月'), ('November','十一月'), ('December','十二月') ,('half','上半年'), ('later','下半年')],string='选择时间') - + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") work_tasks_line_ids = fields.One2many('yuthon.work.tasks.line','plan_id',string='工作任务明细') + plan_management_ids = fields.One2many('yuthon.plan.management.line','plan_id',string='计划管理明细') + def button_plan_management(self): + employee = self.env.user.employee_id + index_list = [] + index_ids = self.env['yuthon.index.management'].search([('employee_ids', 'in', employee.id)]) + for index in index_ids: + index_list.append((0, 0, { + 'task_type': index.index_type, + 'goal': index.index_definition, + })) + self.plan_management_ids = index_list class YuthonWorkTasksLine(models.Model): _name = 'yuthon.work.tasks.line' @@ -21,14 +33,26 @@ class YuthonWorkTasksLine(models.Model): plan_id = fields.Many2one('yuthon.plan.management','关联个人工作任务') select_time = fields.Selection(related='plan_id.select_time',string='选择时间') - task_type = fields.Selection([('KPI','KPI'),('GS','GS')],string='任务类型') + task_type = fields.Selection([('kpi', 'KPI'), + ('gs', 'GS'), ('no', '否决指标')],string='任务类型') task_name = fields.Many2one('yuthon.index.management',string='任务名称') plan = fields.Char('计划安排及具体措施行动') - goal = fields.Char('目标',help="质量、数量、成本等方面要求") + goal = fields.Text('目标',help="质量、数量、成本等方面要求") resource_requirements = fields.Text('资源需求') summarize = fields.Text('完成情况总结') +class YuthonPlanManagementLine(models.Model): + _name = 'yuthon.plan.management.line' + _description = "个人工作任务明细" + + plan_id = fields.Many2one('yuthon.plan.management', '关联个人工作任务') + task_type = fields.Selection([('kpi', 'KPI'), + ('gs', 'GS'), ('no', '否决指标')], string='任务类型') + goal = fields.Text('目标', help="质量、数量、成本等方面要求") + + + diff --git a/yuthon_performance/models/yuthon_tissue_duty_approval.py b/yuthon_performance/models/yuthon_tissue_duty_approval.py index 4f9d5ae93..870e095b2 100644 --- a/yuthon_performance/models/yuthon_tissue_duty_approval.py +++ b/yuthon_performance/models/yuthon_tissue_duty_approval.py @@ -10,6 +10,8 @@ class YuthonTissueDutyApproval(models.Model): name = fields.Char('标题') users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") + yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], string="所属公司") creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now()) code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('duty_approval_code')) job_id = fields.Many2one('hr.job', string="岗位") diff --git a/yuthon_performance/security/ir.model.access.csv b/yuthon_performance/security/ir.model.access.csv index b92ea5d3a..57ba1759b 100644 --- a/yuthon_performance/security/ir.model.access.csv +++ b/yuthon_performance/security/ir.model.access.csv @@ -25,4 +25,5 @@ access_new_index_management_line,new_index_management_line,model_new_index_manag access_new_employee_library_line,new_employee_library_line,model_new_employee_library_line,base.group_user,1,1,1,1 access_new_kpi_duty_approval,new_kpi_duty_approval,model_new_kpi_duty_approval,base.group_user,1,1,1,1 access_new_gs_duty_approval,new_gs_duty_approval,model_new_gs_duty_approval,base.group_user,1,1,1,1 -access_yuthon_work_tasks_line,yuthon_work_tasks_line,model_yuthon_work_tasks_line,base.group_user,1,1,1,1 \ No newline at end of file +access_yuthon_work_tasks_line,yuthon_work_tasks_line,model_yuthon_work_tasks_line,base.group_user,1,1,1,1 +access_yuthon_plan_management_line,yuthon_plan_management_line,model_yuthon_plan_management_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 107d8221f..e71ddb7cc 100644 --- a/yuthon_performance/views/yuthon_Index_approval.xml +++ b/yuthon_performance/views/yuthon_Index_approval.xml @@ -8,6 +8,7 @@ + @@ -25,6 +26,7 @@ + @@ -52,8 +54,8 @@ - - + + @@ -70,8 +72,8 @@ - - + + @@ -92,10 +94,23 @@ - + 组织指标库变更 yuthon.index.approval tree,form + [('yuthon_company','=','thtz')] + + + 组织指标库变更 + yuthon.index.approval + tree,form + [('yuthon_company','=','thlc')] + + + 组织指标库变更 + yuthon.index.approval + tree,form + [('yuthon_company','=','thwg')] \ No newline at end of file diff --git a/yuthon_performance/views/yuthon_Index_management.xml b/yuthon_performance/views/yuthon_Index_management.xml index bc6e52d42..f637d79bc 100644 --- a/yuthon_performance/views/yuthon_Index_management.xml +++ b/yuthon_performance/views/yuthon_Index_management.xml @@ -8,7 +8,7 @@
@@ -20,8 +20,8 @@ - - + + @@ -50,11 +50,11 @@ - + - + @@ -70,23 +70,26 @@
- - yuthon.index.management.search - yuthon.index.management - - - - - - - - - + 组织绩效 yuthon.index.management - tree,form,search + tree,form {'search_default_group_development_goals': 1} + [('yuthon_company','=','thtz')] + + + 组织绩效 + yuthon.index.management + tree,form + {'search_default_group_development_goals': 1} + [('yuthon_company','=','thlc')] + + + 组织绩效 + yuthon.index.management + tree,form + {'search_default_group_development_goals': 1} + [('yuthon_company','=','thwg')] - \ No newline at end of file diff --git a/yuthon_performance/views/yuthon_assessment_tasks.xml b/yuthon_performance/views/yuthon_assessment_tasks.xml index bfe5f0885..1c9500abe 100644 --- a/yuthon_performance/views/yuthon_assessment_tasks.xml +++ b/yuthon_performance/views/yuthon_assessment_tasks.xml @@ -9,6 +9,7 @@ +