第一阶段如何给申请者发邮件;招聘 odoo 14
How to send email to applicants in first stage; recruitment odoo 14
我想在 Odoo 14 招聘的第一阶段向申请人发送电子邮件。如何使用 python 进行?
这是我的代码。
def job_applicant_acknowledgments(self):
for rec in self:
get_first_stage = self.env['hr.recruitment.stage'].search([
'|',
('job_ids', '=', False),
('job_ids', '=', self.id)], order='sequence asc', limit=1)
if self.partner_id and get_first_stage and not emai_sent:
ctx = {}
ctx['email_to'] = rec.partner_id.email
# ctx['email_from'] = self.env.user.user_id.email
# ctx['email_from'] = self.env.user.employee_id.work_email
ctx['send_email'] = True
ctx['partner_id'] = rec.partner_id.id
template = self.env.ref(
'hr_recruitment_custom.job_applicant_acknowledgment')
template.with_context(ctx).send_mail(
rec.id, force_send=True, raise_exception=False)
这就是我需要的。
这是 python 代码,当申请人申请职位或创建职位 ID 招聘时,odoo 会向申请人发送电子邮件。
def job_applicant_acknowledgments(self):
for rec in self:
ctx = {}
ctx['email_to'] = rec.partner_id.email
ctx['email_from'] = self.env.user.user_id.email
ctx['send_email'] = True
ctx['partner_id'] = rec.partner_id.id
template = self.env.ref('hr_recruitment_custom.job_applicant_acknowledgment')
template.with_context(ctx).send_mail(
rec.id, force_send=True, raise_exception=False)
我添加的代码:
def job_applicant_acknowledgments_cron(self):
partner_ids = self.env['hr.applicant'].search([('email_sent', '=', False)])
for applicant in partner_ids:
if applicant.email_sent is False:
applicant.job_applicant_acknowledgments()
applicant.email_sent = True
我想在 Odoo 14 招聘的第一阶段向申请人发送电子邮件。如何使用 python 进行? 这是我的代码。
def job_applicant_acknowledgments(self):
for rec in self:
get_first_stage = self.env['hr.recruitment.stage'].search([
'|',
('job_ids', '=', False),
('job_ids', '=', self.id)], order='sequence asc', limit=1)
if self.partner_id and get_first_stage and not emai_sent:
ctx = {}
ctx['email_to'] = rec.partner_id.email
# ctx['email_from'] = self.env.user.user_id.email
# ctx['email_from'] = self.env.user.employee_id.work_email
ctx['send_email'] = True
ctx['partner_id'] = rec.partner_id.id
template = self.env.ref(
'hr_recruitment_custom.job_applicant_acknowledgment')
template.with_context(ctx).send_mail(
rec.id, force_send=True, raise_exception=False)
这就是我需要的。 这是 python 代码,当申请人申请职位或创建职位 ID 招聘时,odoo 会向申请人发送电子邮件。
def job_applicant_acknowledgments(self):
for rec in self:
ctx = {}
ctx['email_to'] = rec.partner_id.email
ctx['email_from'] = self.env.user.user_id.email
ctx['send_email'] = True
ctx['partner_id'] = rec.partner_id.id
template = self.env.ref('hr_recruitment_custom.job_applicant_acknowledgment')
template.with_context(ctx).send_mail(
rec.id, force_send=True, raise_exception=False)
我添加的代码:
def job_applicant_acknowledgments_cron(self):
partner_ids = self.env['hr.applicant'].search([('email_sent', '=', False)])
for applicant in partner_ids:
if applicant.email_sent is False:
applicant.job_applicant_acknowledgments()
applicant.email_sent = True