Skip to content
Snippets Groups Projects
Commit 8bf68e40 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[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#54148

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 0028a602
No related branches found
No related tags found
No related merge requests found
......@@ -484,11 +484,19 @@ class Slide(models.Model):
publish_template = slide.channel_id.publish_template_id
html_body = publish_template.with_context(base_url=base_url)._render_template(publish_template.body_html, 'slide.slide', slide.id)
subject = publish_template._render_template(publish_template.subject, 'slide.slide', 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_template(publish_template.reply_to, 'slide.slide', 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='website_slides.mt_channel_slide_published',
email_layout_xmlid='mail.mail_notification_light',
**kwargs,
)
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment