fix emp jod
This commit is contained in:
parent
5e4c332ff1
commit
84c8e601e9
|
|
@ -16,19 +16,21 @@ class HREmployee(models.Model):
|
||||||
def send_jod_form_to_employee(self):
|
def send_jod_form_to_employee(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if not rec.applicant_id:
|
if not rec.applicant_id:
|
||||||
application = self.env['hr.applicant'].sudo().search([('employee_id', '=', rec.id)], limit=1)
|
application = self.env['hr.applicant'].sudo().search([('employee_id', '=', rec.id),'|',('company_id','=',False),('company_id','=',self.env.company.id)], limit=1)
|
||||||
if not application:
|
if not application:
|
||||||
candidate = self.env['hr.candidate'].sudo().create({
|
candidate = self.env['hr.candidate'].sudo().create({
|
||||||
'partner_name': rec.name,
|
'partner_name': rec.name,
|
||||||
'email_from': rec.work_email,
|
'email_from': rec.work_email,
|
||||||
'partner_phone': rec.work_phone,
|
'partner_phone': rec.work_phone,
|
||||||
'employee_id': rec.id,
|
'employee_id': rec.id,
|
||||||
|
'company_id': self.env.company.id
|
||||||
})
|
})
|
||||||
|
|
||||||
application = self.env['hr.applicant'].sudo().create({
|
application = self.env['hr.applicant'].sudo().create({
|
||||||
'candidate_id': candidate.id,
|
'candidate_id': candidate.id,
|
||||||
'hr_job_recruitment': self.env.ref('employee_jod.employee_jod_internal_job_recruitment_id').id,
|
'hr_job_recruitment': self.env.ref('employee_jod.employee_jod_internal_job_recruitment_id').id,
|
||||||
'recruitment_stage_id': self.env.ref('employee_jod.hired_stage8').id,
|
'recruitment_stage_id': self.env.ref('employee_jod.hired_stage8').id,
|
||||||
|
'company_id': self.env.company.id
|
||||||
})
|
})
|
||||||
rec.applicant_id = application.id
|
rec.applicant_id = application.id
|
||||||
return rec.sudo().applicant_id.send_jod_form_to_employee()
|
return rec.sudo().applicant_id.send_jod_form_to_employee()
|
||||||
|
|
@ -43,7 +45,7 @@ class PostOnboardingAttachmentWizard(models.TransientModel):
|
||||||
def _onchange_template_id(self):
|
def _onchange_template_id(self):
|
||||||
""" Update the email body and recipients based on the selected template. """
|
""" Update the email body and recipients based on the selected template. """
|
||||||
if self.template_id:
|
if self.template_id:
|
||||||
record_id = self.env.context.get('applicant_id')
|
record_id = self.env.context.get('active_id')
|
||||||
model = self.env.context.get('active_model')
|
model = self.env.context.get('active_model')
|
||||||
if model == 'applicant.request.forms':
|
if model == 'applicant.request.forms':
|
||||||
applicant = self.env['hr.applicant'].browse(record_id)
|
applicant = self.env['hr.applicant'].browse(record_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue