From b26679ce16187db03f10e96cdb5ac7175b4398b4 Mon Sep 17 00:00:00 2001 From: Mitali Patel Date: Mon, 18 Jun 2018 18:15:53 +0530 Subject: [PATCH] [IMP] delivery: make templates more modern and updated with Odoo guidelines In this commit we improve templates used in delivery. 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). --- addons/delivery/data/mail_template_data.xml | 61 ++++++++++++--------- addons/delivery/models/stock_picking.py | 2 +- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/addons/delivery/data/mail_template_data.xml b/addons/delivery/data/mail_template_data.xml index 14e566c5213..e8b6f08ebfc 100644 --- a/addons/delivery/data/mail_template_data.xml +++ b/addons/delivery/data/mail_template_data.xml @@ -1,30 +1,39 @@ - - + - Delivery: Send by Email - ${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' }) - ${object.partner_id.id} - - - ${(object.name or '').replace('/','_')} - ${object.partner_id.lang} - -

Dear ${object.partner_id.name},

-

We are glad to inform you that your order has been shipped.

-

-%if object.carrier_tracking_ref: - Your tracking reference: - %if object.carrier_tracking_url: - ${object.carrier_tracking_ref}. - %else: - ${object.carrier_tracking_ref}. - %endif -%endif -

-

Find your delivery order attached for more details.

-

Thank you,

-
+ Delivery: Send by Email + + ${object.company_id.name} Delivery Order (Ref ${object.name or 'n/a' }) + ${object.partner_id.id} + +
+

+ Hello ${object.partner_id.name},

+ We are glad to inform you that your order has been shipped. + %if object.carrier_tracking_ref: + Your tracking reference is + + %if object.carrier_tracking_url: + ${object.carrier_tracking_ref}. + %else: + ${object.carrier_tracking_ref}. + %endif + + %endif +

+ Please find your delivery order attached for more details.

+ Thank you,
+ % if user and user.signature: + ${user.signature | safe} + % endif +

+
+
+ + ${(object.name or '').replace('/','_')} + ${object.partner_id.lang} + +
-
+
diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 7eddcc52d04..ca8d41cca67 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -141,7 +141,7 @@ class StockPicking(models.Model): default_model='stock.picking', default_use_template=bool(delivery_template_id), default_template_id=delivery_template_id, - custom_layout='mail.mail_notification_borders' + custom_layout='mail.mail_notification_light' ) return { 'type': 'ir.actions.act_window',