Compare commits
49 Commits
a7e6a02fb4
...
577cca1e26
| Author | SHA1 | Date |
|---|---|---|
|
|
577cca1e26 | |
|
|
ea514dfa6d | |
|
|
b30e8b9263 | |
|
|
2dc949db60 | |
|
|
3c72669b85 | |
|
|
86553b0e30 | |
|
|
7568bb3cf3 | |
|
|
2c0dda1842 | |
|
|
e696ccd0d3 | |
|
|
29eb59a59b | |
|
|
0969589920 | |
|
|
41bd88be27 | |
|
|
1a4d1e6b3a | |
|
|
80c57594f4 | |
|
|
fbe2b0778f | |
|
|
29bd5a9514 | |
|
|
7bd905cf4a | |
|
|
5635d0a2b5 | |
|
|
b6f1dc81fe | |
|
|
b2d5ac08ae | |
|
|
8c823769ff | |
|
|
cf1f0bad52 | |
|
|
cf6238d8fd | |
|
|
f2267d4395 | |
|
|
4ef1787c44 | |
|
|
2d7d93fc1f | |
|
|
7feb2e58e3 | |
|
|
896807a24d | |
|
|
1056472a3f | |
|
|
88ac36a3e2 | |
|
|
da5b8559d4 | |
|
|
e148dc191b | |
|
|
d3131bbdc0 | |
|
|
2627887559 | |
|
|
b12f66d2df | |
|
|
c25ad97351 | |
|
|
79a2e7e719 | |
|
|
672f27c0c7 | |
|
|
fae3325eb6 | |
|
|
b37d9ebb42 | |
|
|
71bb424db8 | |
|
|
221649101b | |
|
|
e084e3efbb | |
|
|
3ab8c4c17c | |
|
|
bfc578676b | |
|
|
4afac16cf8 | |
|
|
9ff4c943d3 | |
|
|
8bbffc54a1 | |
|
|
f578cc6cf4 |
|
|
@ -164,7 +164,6 @@ 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
|
||||
|
|
@ -284,20 +283,39 @@ 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)], order='id')
|
||||
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
|
||||
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' and user.employee_id.department_id.name == 'Human Resource']
|
||||
'email_cc': email_cc
|
||||
}
|
||||
# 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",{
|
||||
'applicant': applicant
|
||||
})
|
||||
# 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
|
||||
})
|
||||
|
||||
def safe_date_parse(self,date_str):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue