[FIX] event: always set email author as partner

The `author_id` of a `mail.mail` should always be a `res.partner`
(cfr. [this line][1]).

__Current behavior before commit:__
When `organizer.email` and `company.email` are empty, `author` is set to
the user OdooBot instead of its corresponding partner.

opw-3715380

[1]: https://github.com/odoo/odoo/blob/dcae15dcc072d14164d6454c35ce7d8d870e96ee/addons/mail/wizard/mail_compose_message.py#L107

closes odoo/odoo#153918

X-original-commit: 154de58538b89f5ac9afb9e4889240d67734beac
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Julien (jula)
2024-02-14 08:21:39 +00:00
parent 32c77e26ff
commit 56b3f54fdc
+2 -2
View File
@@ -301,13 +301,13 @@ class EventMailRegistration(models.Model):
for reg_mail in todo:
organizer = reg_mail.scheduler_id.event_id.organizer_id
company = self.env.company
author = self.env.ref('base.user_root')
author = self.env.ref('base.user_root').partner_id
if organizer.email:
author = organizer
elif company.email:
author = company.partner_id
elif self.env.user.email:
author = self.env.user
author = self.env.user.partner_id
email_values = {
'author_id': author.id,