diff --git a/soong_workflow/views/soong_user_role_views.xml b/soong_workflow/views/soong_user_role_views.xml index cc760d191..d0eed59b1 100644 --- a/soong_workflow/views/soong_user_role_views.xml +++ b/soong_workflow/views/soong_user_role_views.xml @@ -45,7 +45,7 @@ - + diff --git a/yuthon_hr_employee/models/yuthon_hr_department.py b/yuthon_hr_employee/models/yuthon_hr_department.py index b3675c76d..cb0eaebf0 100644 --- a/yuthon_hr_employee/models/yuthon_hr_department.py +++ b/yuthon_hr_employee/models/yuthon_hr_department.py @@ -14,6 +14,8 @@ class YuthonHrDepartment(models.Model): department_function = fields.Char(string="部门职能") is_institution = fields.Boolean(string="是否机构") is_global_department = fields.Boolean(string="是否全局部门") + yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), + ('thlc', '天河粮储')], default='thtz', store=True, compute="compute_company",string="所属公司") create_date = fields.Date(string="创建时间", default=fields.Date.today()) start_date = fields.Date(string="生效日期", default=fields.Date.today()) expiration_date = fields.Date(string="失效日期", default=fields.Date.today()) @@ -55,4 +57,21 @@ class YuthonHrDepartment(models.Model): domain = expression.AND([search_domain, domain]) return self._search(domain, limit=limit, order=order) + @api.depends('name', 'parent_id') + def _compute_company(self): + company_mapping = { + '天河投资集团': 'thtz', + '天河物管': 'thwg', + '天河粮储': 'thlc', + '天河投资本部': 'thtjbb', + } + for record in self: + department = record + while department: + if department.name in company_mapping: + record.yuthon_company = company_mapping[department.name] + break + department = department.parent_id + else: + record.yuthon_company = 'thtz' diff --git a/yuthon_hr_employee/views/inherit_hr_job_views.xml b/yuthon_hr_employee/views/inherit_hr_job_views.xml index ac2faeaf0..24c6f9c2e 100644 --- a/yuthon_hr_employee/views/inherit_hr_job_views.xml +++ b/yuthon_hr_employee/views/inherit_hr_job_views.xml @@ -67,6 +67,7 @@ 所属部门 1 + [('yuthon_company', '=' , yuthon_company)] 1 diff --git a/yuthon_hr_employee/views/yuthon_hr_department_views.xml b/yuthon_hr_employee/views/yuthon_hr_department_views.xml index 77befe18e..75dc1da49 100644 --- a/yuthon_hr_employee/views/yuthon_hr_department_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_department_views.xml @@ -25,6 +25,7 @@ + diff --git a/yuthon_performance/models/yuthon_employee_performance.py b/yuthon_performance/models/yuthon_employee_performance.py index 9cbbf5610..17f5ae5c7 100644 --- a/yuthon_performance/models/yuthon_employee_performance.py +++ b/yuthon_performance/models/yuthon_employee_performance.py @@ -37,8 +37,8 @@ class YuthonEmployeePerformance(models.Model): performance_records = super().create(vals_list) for performance in performance_records: self.env['yuthon.assessment.tasks'].create({ - 'name': performance.name, # 使用创建的 performance 记录的 name - 'performance_id': performance.id, # 建立关联关系 + 'name': performance.name, + 'performance_id': performance.id, 'index_statu': performance.index_statu, 'assessment_time': performance.assessment_time, 'performance_type': 'employs' diff --git a/yuthon_performance/static/others/performance_template.xlsx b/yuthon_performance/static/others/performance_template.xlsx new file mode 100644 index 000000000..9d2823902 Binary files /dev/null and b/yuthon_performance/static/others/performance_template.xlsx differ diff --git a/yuthon_performance/wizard/yuthon_performance_indicators__wizard_views.xml b/yuthon_performance/wizard/yuthon_performance_indicators__wizard_views.xml new file mode 100644 index 000000000..29ffec9b8 --- /dev/null +++ b/yuthon_performance/wizard/yuthon_performance_indicators__wizard_views.xml @@ -0,0 +1,34 @@ + + + + 绩效模板 下载 + self + /yuthon_performance/static/others/performance_template.xlsx + + + 审批意见弹窗 + yuthon.performance.indicators.wizard + +
+ +
+
+ + + + + + + + +
+ +
+
+
+
\ No newline at end of file diff --git a/yuthon_performance/wizard/yuthon_performance_indicators_wizard.py b/yuthon_performance/wizard/yuthon_performance_indicators_wizard.py new file mode 100644 index 000000000..d2d52a886 --- /dev/null +++ b/yuthon_performance/wizard/yuthon_performance_indicators_wizard.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields, api, _, SUPERUSER_ID +from odoo.exceptions import ValidationError, UserError +import xlrd +import base64 +import datetime +from datetime import datetime + + +class YuthonPerformanceIndicatorsWizard(models.Model): + _name = 'yuthon.performance.indicators.wizard' + excel_file = fields.Binary(string="上传Excel表") + excel_name = fields.Char(string="文件名") + + def confirm(self): + """ + 导入excel文件,按行读取数据并处理 + :return: 导入员工信息表并更新 + """ + if not self.excel_file: + raise ValidationError('请上传文件。') + book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file)) + sh = book.sheet_by_index(0) \ No newline at end of file