diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-07-06 14:46:40 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-07-09 13:57:42 +0000 |
| commit | 834ebc26ff4bc30f370cdec2656d71612a6e8fab (patch) | |
| tree | c2b32cb409bde63675660b32c0cbf8245f722ff2 | |
| parent | ca3b3d894ba62b2709f073bc0f7379d02914bb32 (diff) | |
[FIX] website_slides: use email_from on new content notif
- Seta a value for the `ir.config_parameter` `mail.catchall.domain`
- Enroll user A to a course
- Add new content to the course
- Publish it
=> an email is sent to the users enrolled
- Reply to the email
The reply is considered as a review of the course.
It is not intended that users reply to such email; they are 'one-way'
notifications.
A solution is to be able to set the `reply_to` field on the mail
template. This way, it's possible to set it to a `noreply` value.
opw-2290521
closes odoo/odoo#54281
X-original-commit: 7ffc300e7c857bf743d7ab25631f9ee02419dea1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
| -rw-r--r-- | addons/website_slides/models/slide_slide.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index b416174141a..5c4596db921 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -510,11 +510,19 @@ class Slide(models.Model): publish_template = slide.channel_id.publish_template_id html_body = publish_template.with_context(base_url=base_url)._render_field('body_html', slide.ids)[slide.id] subject = publish_template._render_field('subject', slide.ids)[slide.id] + # We want to use the 'reply_to' of the template if set. However, `mail.message` will check + # if the key 'reply_to' is in the kwargs before calling _get_reply_to. If the value is + # falsy, we don't include it in the 'message_post' call. + kwargs = {} + reply_to = publish_template._render_field('reply_to', slide.ids)[slide.id] + if reply_to: + kwargs['reply_to'] = reply_to slide.channel_id.with_context(mail_create_nosubscribe=True).message_post( subject=subject, body=html_body, subtype_xmlid='website_slides.mt_channel_slide_published', email_layout_xmlid='mail.mail_notification_light', + **kwargs, ) return True |
