From 45ffab08a7c1dacc70d331077198f92884b53646 Mon Sep 17 00:00:00 2001 From: std-odoo <std@odoo.com> Date: Tue, 27 Apr 2021 09:18:10 +0000 Subject: [PATCH] [FIX] website_event_track: fix new track notifications by email Bug === 1. Create an event which allows track proposal 2. Follow it and subscribe to "New Track" 3. Log in in incognito and submit a proposal The email is not sent, because it's sent as the public user, which has no email address set. And so it the 2 system parameters <mail.catchall.domain> and <mail.default.from> are not set, we can not know which email address used to send the email. Note that this bug also occurs if you create a track with a user without an email address set. Task 2510181 closes odoo/odoo#69890 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> --- addons/website_event_track/models/event_track.py | 2 ++ odoo/addons/base/models/ir_mail_server.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py index e4b7c635d0be..ea62618405b6 100644 --- a/addons/website_event_track/models/event_track.py +++ b/addons/website_event_track/models/event_track.py @@ -322,11 +322,13 @@ class Track(models.Model): tracks = super(Track, self).create(vals_list) for track in tracks: + email_values = {} if self.env.user.email else {'email_from': self.env.company.catchall_formatted} track.event_id.message_post_with_view( 'website_event_track.event_track_template_new', values={'track': track}, subject=track.name, subtype_id=self.env.ref('website_event_track.mt_event_track').id, + **email_values, ) track._synchronize_with_stage(track.stage_id) diff --git a/odoo/addons/base/models/ir_mail_server.py b/odoo/addons/base/models/ir_mail_server.py index 989daa7d64db..15a2faf19ea9 100644 --- a/odoo/addons/base/models/ir_mail_server.py +++ b/odoo/addons/base/models/ir_mail_server.py @@ -284,7 +284,7 @@ class IrMailServer(models.Model): """ email_from = email_from or self._get_default_from_address() assert email_from, "You must either provide a sender address explicitly or configure "\ - "using the combintion of `mail.catchall.domain` and `mail.default.from` "\ + "using the combination of `mail.catchall.domain` and `mail.default.from` "\ "ICPs, in the server configuration file or with the "\ "--email-from startup parameter." -- GitLab