Compare commits
48 Commits
d63c8f9095
...
e733a412f1
| Author | SHA1 | Date |
|---|---|---|
|
|
e733a412f1 | |
|
|
d1a820dc87 | |
|
|
e1bcc0b78a | |
|
|
a26017a46e | |
|
|
eb39db1c3a | |
|
|
aa4589764f | |
|
|
3190290dd2 | |
|
|
ffba64a0e3 | |
|
|
ad702dc97c | |
|
|
775f695375 | |
|
|
445a464e53 | |
|
|
d9de6b202a | |
|
|
c3d775b28e | |
|
|
0e7edd62e6 | |
|
|
7e09097d91 | |
|
|
7edc7209f5 | |
|
|
492a359f88 | |
|
|
df06f8235a | |
|
|
1b119a432c | |
|
|
a46ec717d0 | |
|
|
91299b52c6 | |
|
|
fd70f95fa5 | |
|
|
16a0431e13 | |
|
|
0e05b106ab | |
|
|
5fade12734 | |
|
|
1416789594 | |
|
|
6ff7bbbca0 | |
|
|
6a058acd5d | |
|
|
d67e42f921 | |
|
|
93b9c2ec42 | |
|
|
7120701736 | |
|
|
7257debff4 | |
|
|
bf995294a7 | |
|
|
5eb590f1cd | |
|
|
aecf388beb | |
|
|
2dcb1185b9 | |
|
|
7beeecb343 | |
|
|
fcec9548d2 | |
|
|
d04b918639 | |
|
|
e4ef21bf0d | |
|
|
6276fcd99f | |
|
|
7cfc27a324 | |
|
|
8d159b58ab | |
|
|
5e546b9e53 | |
|
|
c5d8fd8962 | |
|
|
2587abe7fe | |
|
|
98177a6878 | |
|
|
bc4caa9ca1 |
|
|
@ -2,21 +2,16 @@ from odoo import fields, api, models, _
|
|||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class HRApplicant(models.Model):
|
||||
_inherit = 'hr.applicant'
|
||||
|
||||
joining_form_link = fields.Char()
|
||||
|
||||
|
||||
class HREmployee(models.Model):
|
||||
_inherit = 'hr.employee'
|
||||
|
||||
|
||||
applicant_id = fields.Many2one("hr.applicant")
|
||||
|
||||
def send_jod_form_to_employee(self):
|
||||
for rec in self:
|
||||
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)],limit=1)
|
||||
if not application:
|
||||
candidate = self.env['hr.candidate'].sudo().create({
|
||||
'partner_name': rec.name,
|
||||
|
|
@ -35,11 +30,11 @@ class HREmployee(models.Model):
|
|||
return rec.sudo().applicant_id.send_post_onboarding_form_to_candidate()
|
||||
|
||||
|
||||
|
||||
|
||||
class PostOnboardingAttachmentWizard(models.TransientModel):
|
||||
_inherit = 'post.onboarding.attachment.wizard'
|
||||
|
||||
send_mail = fields.Boolean(default=False)
|
||||
|
||||
@api.onchange('template_id')
|
||||
def _onchange_template_id(self):
|
||||
""" Update the email body and recipients based on the selected template. """
|
||||
|
|
@ -70,6 +65,7 @@ class PostOnboardingAttachmentWizard(models.TransientModel):
|
|||
self.email_body = email_template.body_html # Assign the rendered email bodyc
|
||||
self.email_subject = email_template.subject
|
||||
|
||||
|
||||
def action_confirm(self):
|
||||
for rec in self:
|
||||
self.ensure_one()
|
||||
|
|
@ -93,6 +89,7 @@ class PostOnboardingAttachmentWizard(models.TransientModel):
|
|||
lambda a: a.attachment_type == 'previous_employer').mapped('name')
|
||||
other_docs = rec.req_attachment_ids.filtered(lambda a: a.attachment_type == 'others').mapped('name')
|
||||
|
||||
|
||||
# Prepare context for the template
|
||||
email_context = {
|
||||
'personal_docs': personal_docs,
|
||||
|
|
@ -109,30 +106,14 @@ class PostOnboardingAttachmentWizard(models.TransientModel):
|
|||
|
||||
}
|
||||
# Use 'with_context' to override the email template fields dynamically
|
||||
if rec.send_mail:
|
||||
template.sudo().with_context(default_body_html=rec.email_body,
|
||||
**email_context).send_mail(applicant.id, email_values=email_values,
|
||||
force_send=True)
|
||||
base_url = self.get_base_url()
|
||||
template.sudo().with_context(default_body_html=rec.email_body,
|
||||
**email_context).send_mail(applicant.id, email_values=email_values,
|
||||
force_send=True)
|
||||
|
||||
|
||||
if rec.is_pre_onboarding_attachment_request:
|
||||
applicant.doc_requests_form_status = 'email_sent_to_candidate'
|
||||
else:
|
||||
applicant.post_onboarding_form_status = 'email_sent_to_candidate'
|
||||
applicant.joining_form_link = '%s/FTPROTECH/JoiningForm/%s'%(base_url,applicant.id)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
def get_base_url(self):
|
||||
""" Return rooturl for a specific record.
|
||||
|
||||
By default, it returns the ir.config.parameter of base_url
|
||||
but it can be overridden by model.
|
||||
|
||||
:return: the base url for this record
|
||||
:rtype: str
|
||||
"""
|
||||
if len(self) > 1:
|
||||
raise ValueError("Expected singleton or no record: %s" % self)
|
||||
return self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
|
|
|
|||
|
|
@ -11,34 +11,4 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_post_onboarding_attachment_wizard_form_inherit" model="ir.ui.view">
|
||||
<field name="name">post.onboarding.attachment.wizard.form.inherit</field>
|
||||
<field name="model">post.onboarding.attachment.wizard</field>
|
||||
<field name="inherit_id" ref="hr_recruitment_extended.view_post_onboarding_attachment_wizard_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='req_attachment_ids']" position="after">
|
||||
<field name="send_mail"/>
|
||||
</xpath>
|
||||
<xpath expr="//notebook" position="attributes">
|
||||
<attribute name="invisible">not send_mail</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_confirm']" position="attributes">
|
||||
<attribute name="string">Send</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="hr_applicant_view_form_inherit_extend" model="ir.ui.view">
|
||||
<field name="name">hr.applicant.view.form.extend</field>
|
||||
<field name="model">hr.applicant</field>
|
||||
<field name="inherit_id" ref="hr_recruitment_extended.hr_applicant_view_form_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='post_onboarding_form_status']" position="after">
|
||||
<field name="joining_form_link" force_save="1" readonly="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue