diff --git a/yuthon_hr_employee_approval/models/inherit_hr_job.py b/yuthon_hr_employee_approval/models/inherit_hr_job.py
index f96a82767..13736b8d6 100644
--- a/yuthon_hr_employee_approval/models/inherit_hr_job.py
+++ b/yuthon_hr_employee_approval/models/inherit_hr_job.py
@@ -14,14 +14,10 @@ class HrJob(models.Model):
for pub in self:
if pub.compiling_status != '1':
raise UserError('只有缺编的岗位才可以发布申请')
- for rec in self.env['yuthon.recruitment.approval'].search([]):
- for i in rec.recruitment_ids:
- if pub.id == i.id:
- pub.is_pub = True
- raise UserError('该岗位已经发布申请,请勿重复提交,到对应流程中查看,流程的流水号为 %s' % rec.code)
hr_job_ids = self.env["hr.job"].browse(self._context.get('active_ids', self._context.get('active_id')))
first_department_id = hr_job_ids[0].department_id
for hr_job in hr_job_ids:
+ hr_job.write({'is_published': True})
if hr_job.department_id != first_department_id:
raise UserError("招聘需部门相同,请重新选择")
enable = bool(hr_job_ids.filtered('is_enable'))
diff --git a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
index 9e553198a..d21da70cf 100644
--- a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
@@ -17,7 +17,6 @@ class YuthonRecruitmentApproval(models.Model):
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', '天河粮储')], string="所属公司")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
@@ -58,4 +57,16 @@ class YuthonRecruitmentApproval(models.Model):
if self.recruitment_ids:
for record in self.recruitment_ids:
name_list.append(record.name)
- self.name = record.department_id.name +', '.join(name_list)+'的招聘需求申请表'
\ No newline at end of file
+ self.name = record.department_id.name +', '.join(name_list)+'的招聘需求申请表'
+
+ def write(self, vals):
+ # 调用父类的 write 方法,先保存数据
+ res = super(YuthonRecruitmentApproval, self).write(vals)
+ # 检查是否更新了 no_of_recruitment 字段
+ if 'recruitment_employees' in vals:
+ for record in self:
+ # 遍历 recruitment_ids 中的每个 hr.job 记录
+ for job in record.recruitment_ids:
+ # 将 no_of_recruitment 同步到 hr.job 记录中
+ job.write({'recruitment_employees': record.recruitment_employees})
+ return res
\ No newline at end of file
diff --git a/yuthon_hr_employee_approval/views/yuthon_account_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_account_approval_views.xml
index fe7e18065..3c128e6ca 100644
--- a/yuthon_hr_employee_approval/views/yuthon_account_approval_views.xml
+++ b/yuthon_hr_employee_approval/views/yuthon_account_approval_views.xml
@@ -14,7 +14,7 @@
yuthon.account.approval.form
yuthon.account.approval
-