Compare commits
48 Commits
577cca1e26
...
a7e6a02fb4
| Author | SHA1 | Date |
|---|---|---|
|
|
a7e6a02fb4 | |
|
|
4f56cf66c7 | |
|
|
fc569e18c9 | |
|
|
5bad012769 | |
|
|
b03e903963 | |
|
|
d4191a9a84 | |
|
|
ff0191cb42 | |
|
|
064baee48b | |
|
|
9e5f1f22c3 | |
|
|
f5a6b0f444 | |
|
|
f7411e1ce4 | |
|
|
d787150ee4 | |
|
|
128f3350ee | |
|
|
b42db439cf | |
|
|
07a4061349 | |
|
|
65bf653ebc | |
|
|
7b42350819 | |
|
|
56e2c05a6e | |
|
|
255839e2a0 | |
|
|
16ff6d80d8 | |
|
|
50af9581a4 | |
|
|
f65e4f8302 | |
|
|
06949d6aad | |
|
|
348a5ce585 | |
|
|
2451382c85 | |
|
|
cc006a8001 | |
|
|
ecddf3c9dd | |
|
|
966a6f6b8b | |
|
|
b0f6731d23 | |
|
|
370f99d271 | |
|
|
08b66f6133 | |
|
|
c8f7ec7ed0 | |
|
|
31cc483421 | |
|
|
3f31136244 | |
|
|
cb058fcb71 | |
|
|
9126f98aba | |
|
|
d91a30e989 | |
|
|
5c66aaa472 | |
|
|
be44eab021 | |
|
|
5008d05d95 | |
|
|
b5a08bb628 | |
|
|
894d2c0491 | |
|
|
741023556a | |
|
|
aa683334c3 | |
|
|
e7c29ab7d1 | |
|
|
99d8649b3a | |
|
|
f5fcd679ac | |
|
|
ce53fb3495 |
|
|
@ -164,6 +164,7 @@ class website_hr_recruitment_applications(http.Controller):
|
|||
@http.route(['/FTPROTECH/submit/<int:applicant_id>/JoinForm'], type='http', auth="public",
|
||||
methods=['POST'], website=True, csrf=False)
|
||||
def process_employee_joining_form(self,applicant_id,**post):
|
||||
|
||||
applicant = request.env['hr.applicant'].sudo().browse(applicant_id)
|
||||
if not applicant.exists():
|
||||
return request.not_found() # Return 404 if applicant doesn't exist
|
||||
|
|
@ -283,39 +284,20 @@ 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)
|
||||
# Get HR managers with HR department
|
||||
group = request.env.ref('hr.group_hr_manager')
|
||||
users = request.env['res.users'].sudo().search([
|
||||
('groups_id', 'in', group.ids),
|
||||
('email', '!=', False),
|
||||
('email', '!=', 'hr@ftprotech.com'),
|
||||
('employee_id.department_id.name', '=', 'Human Resource')
|
||||
])
|
||||
|
||||
# Extract emails and join them into a comma-separated string
|
||||
email_cc = ','.join([user.email for user in users])
|
||||
|
||||
# Prepare email values
|
||||
users = request.env['res.users'].sudo().search([('groups_id', 'in', group.ids)], order='id')
|
||||
email_values = {
|
||||
'email_from': applicant.email_from,
|
||||
'email_to': 'hr@ftprotech.com',
|
||||
'email_cc': email_cc
|
||||
'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)
|
||||
|
||||
# Debug: Print the email_cc value to verify
|
||||
print(f"Email CC value: {email_values['email_cc']}")
|
||||
|
||||
# Send email
|
||||
template.sudo().send_mail(
|
||||
applicant.id,
|
||||
email_values=email_values,
|
||||
force_send=True
|
||||
)
|
||||
|
||||
# Render thank you page
|
||||
return request.render("hr_recruitment_extended.thank_you_template", {
|
||||
'applicant': applicant
|
||||
})
|
||||
return request.render("hr_recruitment_extended.thank_you_template",{
|
||||
'applicant': applicant
|
||||
})
|
||||
|
||||
def safe_date_parse(self,date_str):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue