[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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user