odoo/odoo#252499
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:master-saas-18.4-opw-5980079-send_email_on_candidate_refusal-mdek-505132-fw
- head
- 76b60baf0306ef611ae42dffaed1c895ca9d60a4
- merged
- 3 months ago by Maeva de Keyser (mdek)
| odoo/odoo | |
|---|---|
| saas-18.4 | #252036 |
| 19.0 | #252255 |
| saas-19.1 | #252312 |
| saas-19.2 | #252334 |
| saas-19.3 | |
| master | #252499 |
[FIX] hr_recruitment: send mail when candidate is refused
Short functional explanation of the error
When a candidate is refused, an email isn't sent to their email address.
Reproduction Steps
- Open Mailhog in a separate tab.
- Go to the Recruitment app and select any job position.
- Click on new to create a new application. Enter an applicant name and an applicant email.
- Check Mailhog: a job application has been sent to the applicant.
- Go back on the Recruitment app and click on Refuse. In the wizard, make sure you toggle Send Email and click on Refuse.
Expected behavior
In Mailhog, a refusal mail has been sent to the applicant.
Unexpected behavior
Nothing is sent.
Origin of the issue
When refusing a candidate, we create a notification in the chatter but an email isn't sent. This is due to the incoming_email_to field, which is checked here:
https://github.com/odoo/odoo/blob/bfc1c210eca65de1116aa09cdd62749ed9192407/addons/mail/models/mail_thread.py#L4040-L4053
but because this field is already retrieved here:
https://github.com/odoo/odoo/blob/bfc1c210eca65de1116aa09cdd62749ed9192407/addons/mail/models/mail_thread.py#L4025 the last condition will always be true, preventing the recipient's data to be added to the message, thus preventing the message to be sent correctly.
Note: as of 19.0, the field outgoing_email_to can be used to determine the recipient's email address.
Note: we remove 'body_is_html': True because this field
is misused in this case: when set at true, the field is always
considered as HTML
__
opw-5980079