JOD EMAIL CHANGE-FIX

This commit is contained in:
pranay 2025-09-15 12:46:15 +05:30
parent ec4cbda4c0
commit 495c27d96d
2 changed files with 8 additions and 16 deletions

View File

@ -282,7 +282,6 @@ class website_hr_recruitment_applications(http.Controller):
]
applicant.write(applicant_data)
template = request.env.ref('hr_recruitment_extended.email_template_post_onboarding_form_user_submit',
raise_if_not_found=False)
group = request.env.ref('hr.group_hr_manager')
@ -290,13 +289,15 @@ class website_hr_recruitment_applications(http.Controller):
email_values = {
'email_from': applicant.email_from,
'email_to': 'hr@ftprotech.com',
'email_cc': [user.email for user in users if user.email != 'hr@ftprotech.com']
'email_cc': [user.email for user in users if user.email != 'hr@ftprotech.com' and user.employee_id.department_id.name == 'Human Resource']
}
# Use 'with_context' to override the email template fields dynamically
template.sudo().send_mail(applicant.id, email_values=email_values,
force_send=True)
return request.render("hr_recruitment_extended.thank_you_template")
return request.render("hr_recruitment_extended.thank_you_template",{
'applicant': applicant
})
def safe_date_parse(self,date_str):
try:

View File

@ -308,30 +308,22 @@
</strong>
,
</p>
<t t-set="applicant_name" t-value="object.candidate_id.partner_name or 'Applicant'"/>
<t t-if="object.employee_code">
<t t-set="employee_code" t-value="object.employee_code"/>
</t>
<p>
<t t-esc="applicant_name"/> has submitted the Joining Formalities (JOD) Form. Please click the link below to review the details.
</p>
<t t-set="base_url"
t-value="object.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
<t t-set="form_url"
t-value="base_url + '/odoo/hr.applicant/' % object.id"/>
<t t-set="base_url" t-value="object.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
<!-- FIXED LINE: Using proper string concatenation -->
<t t-set="form_url" t-value="base_url + '/odoo/hr.applicant/' + str(object.id)"/>
<p style="text-align: center; margin-top: 20px;">
<a t-att-href="form_url" target="_blank"
style="background-color: #007bff; color: #fff; padding: 10px 20px; text-decoration: none;
font-weight: bold; border-radius: 5px; display: inline-block;">
<a t-att-href="form_url" target="_blank" style="background-color: #007bff; color: #fff; padding: 10px 20px; text-decoration: none; font-weight: bold; border-radius: 5px; display: inline-block;">
Open Application
</a>
</p>
<p>Best Regards,
<br/>
<strong>
@ -339,7 +331,6 @@
</strong>
</p>
</div>
</field>
</record>
<record id="email_template_post_onboarding_form" model="mail.template">