From 61b27ed10d750dae8f17104eacc8be98ded3d8b5 Mon Sep 17 00:00:00 2001
From: zhouzhou <123@qq.com>
Date: Wed, 6 Nov 2024 16:05:15 +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
---
soong_workflow/models/soong_workflow.py | 2 +-
yuthon_hr_employee/__manifest__.py | 1 +
.../data/employee_recruitment_time_data.xml | 18 ++++
yuthon_hr_employee/models/inherit_hr_job.py | 8 ++
.../views/inherit_hr_job_views.xml | 4 +
.../models/inherit_hr_applicant.py | 36 +++----
.../models/inherit_hr_job.py | 18 +---
.../models/yuthon_interview_approval.py | 4 +
.../models/yuthon_prepare_approval.py | 98 ++++++++++++++++--
.../models/yuthon_recruitment_approval.py | 11 ++-
.../security/ir.model.access.csv | 3 +-
.../views/yuthon_interview_approval_views.xml | 3 +-
.../views/yuthon_prepare_approval_views.xml | 99 +++++++++++++------
.../yuthon_recruitment_approval_views.xml | 11 ++-
.../views/property_merge_approval_views.xml | 4 +-
yuthon_work_brand/views/hr_menus.xml | 16 +--
16 files changed, 239 insertions(+), 97 deletions(-)
create mode 100644 yuthon_hr_employee/data/employee_recruitment_time_data.xml
diff --git a/soong_workflow/models/soong_workflow.py b/soong_workflow/models/soong_workflow.py
index e6a4d888c..073ebb319 100644
--- a/soong_workflow/models/soong_workflow.py
+++ b/soong_workflow/models/soong_workflow.py
@@ -187,4 +187,4 @@ class SoongWorkflow(models.Model):
for record in self.search([]):
if record.end_date:
if record.end_date < fields.Date.today():
- record.is_enable = False
+ record.is_enable = False
\ No newline at end of file
diff --git a/yuthon_hr_employee/__manifest__.py b/yuthon_hr_employee/__manifest__.py
index 722fb0e5f..6c6a80c82 100644
--- a/yuthon_hr_employee/__manifest__.py
+++ b/yuthon_hr_employee/__manifest__.py
@@ -17,6 +17,7 @@
'data/job_lv_groups_data.xml',
'data/employee_code_data.xml',
'data/applicant_tage_setting_data.xml',
+ 'data/employee_recruitment_time_data.xml',
'data/publish_applicant_setting_data.xml',
'security/ir.model.access.csv',
'security/job_lv_security_group.xml',
diff --git a/yuthon_hr_employee/data/employee_recruitment_time_data.xml b/yuthon_hr_employee/data/employee_recruitment_time_data.xml
new file mode 100644
index 000000000..049f68a72
--- /dev/null
+++ b/yuthon_hr_employee/data/employee_recruitment_time_data.xml
@@ -0,0 +1,18 @@
+
+
+
+
+ 定时任务:招聘岗位的失效时间
+
+ code
+ model.employee_recruitment_time()
+
+
+ 1
+ days
+
+ -1
+
+
+
+
diff --git a/yuthon_hr_employee/models/inherit_hr_job.py b/yuthon_hr_employee/models/inherit_hr_job.py
index eb141e66e..45ba059c4 100644
--- a/yuthon_hr_employee/models/inherit_hr_job.py
+++ b/yuthon_hr_employee/models/inherit_hr_job.py
@@ -5,12 +5,14 @@ import datetime
class HrJob(models.Model):
_inherit = "hr.job"
+ _order = 'number asc'
_sql_constraints = [
('name_company_uniq', 'unique(name)', 'The name of the job position must be unique per department in company!'),
('no_of_recruitment_positive', 'CHECK(no_of_recruitment >= 0)', 'The expected number of new employees must be positive.')
]
+ number = fields.Char(string="序号", store=True)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建'),('thtjbb', '天河投资本部')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类别")
@@ -74,6 +76,12 @@ class HrJob(models.Model):
else:
rec.is_enable = False
+ def employee_recruitment_time(self):
+ for record in self.search([]):
+ if record.end_date:
+ if record.end_date < fields.Date.today():
+ record.is_enable = False
+
class HrJobType(models.Model):
_name = "hr.job.type"
diff --git a/yuthon_hr_employee/views/inherit_hr_job_views.xml b/yuthon_hr_employee/views/inherit_hr_job_views.xml
index c0d580c21..51619017c 100644
--- a/yuthon_hr_employee/views/inherit_hr_job_views.xml
+++ b/yuthon_hr_employee/views/inherit_hr_job_views.xml
@@ -20,6 +20,9 @@
1
+
+
+
@@ -106,6 +109,7 @@
+
diff --git a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py
index bc3e4ca8b..ed5b5c19b 100644
--- a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py
+++ b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py
@@ -7,7 +7,7 @@ class HrApplicant(models.Model):
interview_approval_id = fields.Many2one('yuthon.interview.approval', string="面试申请表关联")
interview_time = fields.Datetime(string='面试时间')
room_id = fields.Many2one('room.room',string='地点')
- interview_results = fields.Selection([('pass', '通过'), ('fail', '不通过')], string="面试结果")
+ interview_stage_id = fields.Many2one('hr.recruitment.stage', string='面试阶段')
tage_ids = fields.Many2many('applicant.tage.setting', string="应聘标签")
employee_ids = fields.Many2many('hr.employee', string='面试官')
@@ -21,7 +21,6 @@ class HrApplicant(models.Model):
'target': 'current',
}
-
def pub_interview_approval(self):
for applicant in self:
if not applicant.is_interview_status:
@@ -31,26 +30,19 @@ class HrApplicant(models.Model):
hr_applicant_ids = self.env["hr.applicant"].browse(self._context.get('active_ids', self._context.get('active_id')))
hr_applicant_data = [(6, 0, hr_applicant_ids.ids)]
- stage_list = [stage.name for stage in self.env['hr.recruitment.stage'].search([])] # 便利出所有的阶段
-
- for sta in self:
- stage_self = stage_list.index(sta.stage_id.name)
- if stage_self == 0:
- sta.stage_id = self.env['hr.recruitment.stage'].search([('name', '=', stage_list[stage_self + 1])]).id
-
- form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id
- return {
- 'type': 'ir.actions.act_window',
- 'name': '提交面试申请',
- 'res_model': 'yuthon.interview.approval',
- "views": [[form_id, "form"]],
- "context": {
- 'default_name': '面试申请表',
- 'default_job_id': self.job_id.id,
- 'default_department_id': self.department_id.id,
- 'default_applicant_ids': hr_applicant_data
- }
+ form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': '提交面试申请',
+ 'res_model': 'yuthon.interview.approval',
+ "views": [[form_id, "form"]],
+ "context": {
+ 'default_name': '面试申请表',
+ 'default_job_id': self.job_id.id,
+ 'default_department_id': self.department_id.id,
+ 'default_applicant_ids': hr_applicant_data
}
+ }
def write(self, vals):
@@ -78,4 +70,4 @@ class HrApplicant(models.Model):
"views": [[form_id, "form"]],
'context': {
'onboard_id': self.id, },
- }
\ No newline at end of file
+ }
diff --git a/yuthon_hr_employee_approval/models/inherit_hr_job.py b/yuthon_hr_employee_approval/models/inherit_hr_job.py
index f2e0b5e4e..3b5520de2 100644
--- a/yuthon_hr_employee_approval/models/inherit_hr_job.py
+++ b/yuthon_hr_employee_approval/models/inherit_hr_job.py
@@ -33,22 +33,6 @@ class HrJob(models.Model):
def pub_prepare_approval_button(self):
hr_job_ids = self.env["hr.job"].browse(self._context.get('active_ids', self._context.get('active_id')))
- hr_job_data = []
- for job in hr_job_ids:
- hr_job_data.append((0, 0, {
- 'name': job.name,
- 'department_id': job.department_id.id,
- 'job_type_id': job.job_type_id.id,
- 'job_lv_id': job.job_lv_id.name,
- 'yuthon_company': job.yuthon_company,
- 'establishment_quotas': job.establishment_quotas,
- 'no_of_employee': job.no_of_employee,
- 'compiling_external': job.compiling_external,
- 'missing_number': job.missing_number,
- 'compiling_status': job.compiling_status,
- 'job_personnel': job.job_personnel,
- 'remarks': job.remarks,
- }))
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_prepare_approval_form").id
return {
'type': 'ir.actions.act_window',
@@ -56,6 +40,6 @@ class HrJob(models.Model):
'res_model': 'yuthon.prepare.approval',
"views": [[form_id, "form"]],
"context": {
- 'default_adjust_information_ids': hr_job_data,
+ 'default_adjust_information_ids': [(6 ,0 , hr_job_ids.ids)],
}
}
diff --git a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py
index 0c22c1018..69f0e618c 100644
--- a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py
@@ -33,4 +33,8 @@ class YuthonInterviewApproval(models.Model):
}
}
+ def put_interview_stage(self):
+ for rec in self.applicant_ids:
+ rec.write({
+ 'stage_id': rec.interview_stage_id.id})
diff --git a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
index b3b4d44ea..b79631c88 100644
--- a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
@@ -6,16 +6,100 @@ class YuthonPrepareApproval(models.Model):
_description = '编制调整需求表'
_inherit = 'soong.workflow.mixin'
-
-
- name = fields.Char(string='名称')
+ employee_id = fields.Many2one('hr.employee', string='申请人', default=lambda self: self.env.user.employee_id)
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_prepare_approval_code'))
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
- department_id = fields.Many2one("hr.department", string="部门", required=True)
- reason = fields.Char(string="事由")
- notice_documents_ids = fields.Many2many('documents.document', string="附件")
+ department_id = fields.Many2one("hr.department", string="部门",)
+ name = fields.Char(string='标题')
+ reason = fields.Html(string="正文")
+ is_issues = fields.Boolean(string='是否上会')
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
+ notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
+ adjust_information_ids = fields.One2many('hr.job', 'prepare_approval_id', string="关联调整信息")
+ prepare_approval_line_ids = fields.One2many('yuthon.prepare.approval.line', 'prepare_approval_id', string="关联编制调整需求表行")
+
+ @api.onchange('adjust_information_ids')
+ def onchange_change_index_library_ids(self):
+ new_lines = []
+ for old in self:
+ for new in old.adjust_information_ids:
+ new_lines.append((0, 0, {
+ 'name': new.name,
+ 'department_id': new.department_id,
+ 'yuthon_company': new.yuthon_company,
+ 'job_type_id': new.job_type_id,
+ 'compiling_external': new.compiling_external,
+ 'job_lv_id': new.job_lv_id,
+ 'establishment_quotas': new.establishment_quotas,
+ 'no_of_employee': new.no_of_employee,
+ 'missing_number': new.missing_number,
+ 'compiling_status': new.compiling_status,
+ 'job_personnel': new.job_personnel,
+ 'remarks': new.remarks,
+ }))
+ self.prepare_approval_line_ids = new_lines
- adjust_information_ids = fields.One2many('hr.job', 'prepare_approval_id', string="调整信息")
\ No newline at end of file
+ def put_adjustment_approval(self):
+ self.ensure_one()
+ for prepare, adjust in zip(self.prepare_approval_line_ids, self.adjust_information_ids):
+ adjust.write({
+ 'name': prepare.name,
+ 'department_id': prepare.department_id.id,
+ 'yuthon_company': prepare.yuthon_company,
+ 'job_type_id': prepare.job_type_id.id,
+ 'compiling_external': prepare.compiling_external,
+ 'job_lv_id': prepare.job_lv_id.id,
+ 'establishment_quotas': prepare.establishment_quotas,
+ 'no_of_employee': prepare.no_of_employee,
+ 'missing_number': prepare.missing_number,
+ 'compiling_status': prepare.compiling_status,
+ 'job_personnel': prepare.job_personnel,
+ 'remarks': prepare.remarks,
+ })
+
+
+class PrepareApprovalLine(models.Model):
+ _name = 'yuthon.prepare.approval.line'
+ _description = '新编制调整需求表行'
+ _inherit = 'soong.workflow.mixin'
+
+ prepare_approval_id = fields.Many2one('yuthon.prepare.approval', string="编制调整需求表")
+ name = fields.Char(string='工作岗位')
+ department_id = fields.Many2one("hr.department", string="部门")
+ yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
+ ('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
+ job_type_id = fields.Many2one('hr.job.type', string="岗位类型")
+ compiling_external = fields.Integer(string="编制外人数")
+ job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
+ establishment_quotas = fields.Integer(string="编制人数")
+ no_of_employee = fields.Integer(string="当前员工数量")
+ missing_number = fields.Integer(string="缺编人数",compute='_compute_missing_number')
+ compiling_status = fields.Selection([('1', '缺编'), ('2', '满编')], compute="_compute_compiling_status", string="状态")
+ job_personnel = fields.Char(string="在岗人员", compute='_compute_job_personnel')
+ remarks = fields.Text(string="备注")
+
+ @api.depends('establishment_quotas', 'no_of_employee')
+ def _compute_missing_number(self):
+ for rec in self:
+ if rec.establishment_quotas <= rec.no_of_employee:
+ rec.missing_number = 0
+ else:
+ rec.missing_number = abs(rec.establishment_quotas - rec.no_of_employee)
+
+ @api.depends('no_of_employee')
+ def _compute_job_personnel(self):
+ for rec in self:
+ employee_ids = rec.env['hr.employee'].search([('job_id', '=', rec.id)])
+ employee_list = [rec.name for rec in employee_ids]
+ rec.job_personnel = ','.join(employee_list)
+
+ @api.depends('establishment_quotas', 'no_of_employee')
+ def _compute_compiling_status(self):
+ for state in self:
+ if state.missing_number > 0:
+ state.compiling_status = '1'
+ else:
+ state.compiling_status = '2'
\ No newline at end of file
diff --git a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
index d8ead8a8b..33d976e38 100644
--- a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
@@ -7,18 +7,21 @@ class YuthonRecruitmentApproval(models.Model):
_inherit = 'soong.workflow.mixin'
name = fields.Char(string='标题')
- employee_id = fields.Many2one('hr.employee', string='申请人', default=lambda self: self.env.user.employee_id)
+ employee_id = fields.Many2one('hr.employee',string='申请人', default=lambda self: self.env.user.employee_id)
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_recruitment_approval_code'))
reason = fields.Html(string="正文")
- notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
recruitment_ids = fields.One2many('hr.job', 'recruitment_approval_id', string="招聘申请")
is_issues = fields.Boolean(string='是否上会')
related_issues_id = fields.Many2one('issue.library', string="关联议题")
+ notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
- ('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
+ ('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
department_id = fields.Many2one("hr.department", string="部门")
-
+ def put_time_failure(self):
+ for record in self:
+ for recruitment in record.recruitment_ids:
+ recruitment.website_published = True
diff --git a/yuthon_hr_employee_approval/security/ir.model.access.csv b/yuthon_hr_employee_approval/security/ir.model.access.csv
index 28f5dd35c..fdc5525a3 100644
--- a/yuthon_hr_employee_approval/security/ir.model.access.csv
+++ b/yuthon_hr_employee_approval/security/ir.model.access.csv
@@ -28,4 +28,5 @@ access_education_details_line2,education_details_line2,model_education_details_l
access_certificates_detail_line,certificates_detail_line,model_certificates_detail_line,base.group_user,1,1,1,1
access_yuthon_transfer_approval,yuthon_transfer_approval,model_yuthon_transfer_approval,base.group_user,1,1,1,1
access_yuthon_transfer_infor_detail_lines,yuthon_transfer_infor_detail_lines,model_yuthon_transfer_infor_detail_lines,base.group_user,1,1,1,1
-access_yuthon_social_files_approval,yuthon_social_files_approval,model_yuthon_social_files_approval,base.group_user,1,1,1,1
\ No newline at end of file
+access_yuthon_social_files_approval,yuthon_social_files_approval,model_yuthon_social_files_approval,base.group_user,1,1,1,1
+access_yuthon_prepare_approval_line,yuthon_prepare_approval_line,model_yuthon_prepare_approval_line,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml
index b4b69fbf4..57d7169ff 100644
--- a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml
+++ b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml
@@ -19,6 +19,7 @@