From 6970cd0e80013a7f62bc9c184b37f98ae180eabc Mon Sep 17 00:00:00 2001 From: Mitali Patel Date: Wed, 20 Jun 2018 15:19:53 +0530 Subject: [PATCH] [IMP] website_slides: make templates more modern and updated with Odoo guidelines In this commit we improve templates used in website_slides. Purpose of this commit is to have templates that embed or use standard Odoo email layouts to make them look modern and have a common style across all emails. Main guidelines * better use of div / p / br to try to lessen layout issues, especially when updating templates using the editor; * correctly sequence the templates fields definition; * correctly set templates values notably auto_delete and user_signature fields to avoid confusion; * correctly layout the email content using light notification email. It can either propagate the layout choice through various send mail methods or directly embed the styling in the templates for more technical or complex templates; * use email_formatted computed field when possible to avoid having hand-made from / to addresses; * fix various typos and improve subjects when necessary; Content of emails is not necessarily updated as the purpose of this task is about styling, not content itself. This commit is linked to task ID 1843376 (and 1868112) and closes PR #25349 (and #25889). --- .../data/website_slides_data.xml | 72 ++++++++++--------- addons/website_slides/models/slides.py | 6 +- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/addons/website_slides/data/website_slides_data.xml b/addons/website_slides/data/website_slides_data.xml index 1b174481796..05d5f2d0aca 100644 --- a/addons/website_slides/data/website_slides_data.xml +++ b/addons/website_slides/data/website_slides_data.xml @@ -16,50 +16,54 @@ Slide Published - New ${object.slide_type} published on ${object.channel_id.name} + New ${object.slide_type} published on ${object.channel_id.name} + +
+

+ Hello

+ A new ${object.slide_type} ${object.name} has been published on ${object.channel_id.name} at ${format_tz(object.write_date, tz=user.tz)} +

+ + ${object.name} + +
+ +

+
+
- Hello,

-

- A new ${object.slide_type} ${object.name} has been published on ${object.channel_id.name} at ${format_tz(object.write_date, tz=user.tz)} -

-

- - ${object.name} - -

-

- - View ${object.name} - -

-]]>
+
Slide Shared - ${user.name} shared a ${object.slide_type} with you! + ${user.name} shared a ${object.slide_type} with you! ${(user.email or '')|safe} ${ctx['email']} + +
+

+ Hello

+ ${user.name} shared the ${object.slide_type} ${object.name} with you! +

+ + ${object.name} + +
+ +

+
+
- Hello,

-

- ${user.name} shared the ${object.slide_type} ${object.name} with you! -

-

- - ${object.name} - -

-

- - View ${object.name} - -

-]]>
+
diff --git a/addons/website_slides/models/slides.py b/addons/website_slides/models/slides.py index b582902eb30..9346e937064 100644 --- a/addons/website_slides/models/slides.py +++ b/addons/website_slides/models/slides.py @@ -488,13 +488,15 @@ class Slide(models.Model): slide.channel_id.message_post( subject=subject, body=html_body, - subtype='website_slides.mt_channel_slide_published') + subtype='website_slides.mt_channel_slide_published', + notif_layout='mail.mail_notification_light', + ) return True @api.one def send_share_email(self, email): base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') - return self.channel_id.share_template_id.with_context(email=email, base_url=base_url).send_mail(self.id) + return self.channel_id.share_template_id.with_context(email=email, base_url=base_url).send_mail(self.id, notif_layout='mail.mail_notification_light') # -------------------------------------------------- # Parsing methods