From d8496aea2e41fd72960b9337a968a08c1c573b46 Mon Sep 17 00:00:00 2001
From: Mitali Patel
Date: Mon, 18 Jun 2018 16:26:46 +0530
Subject: [PATCH 01/25] [REM] mail: remove duplicated mass mailing action on
partner
This action allowing to send a mass mailing with a default template on a
partner is defined twice in mail on same object, with same xml_id. See in
composer views for the other definition.
This commit is linked to task ID 1843361 (and 1868112) and to PR #25287
(and #25889).
---
addons/mail/wizard/mail_compose_message_view.xml | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml
index 9c349c36bc2..9995bc15f04 100644
--- a/addons/mail/wizard/mail_compose_message_view.xml
+++ b/addons/mail/wizard/mail_compose_message_view.xml
@@ -94,20 +94,5 @@
formnew
-
-
-
From 298904f1d90bae2ebc3c544f3d1bd5d26f3247ca Mon Sep 17 00:00:00 2001
From: Kirti Choudhary
Date: Fri, 13 Jul 2018 10:24:19 +0200
Subject: [PATCH 02/25] [REM] crm: remove unnecessary mail template data
This template was linked to an old automated rule used as a demo sending
an email to old opportunities. The demo automated rule has been removed
since. Moreover there is already a mail template used for mass mailing
in crm. No need to have unnecessary data especially it is not linked to
any business flow.
This commit is linked to task ID 1841503 (and 1868112) and to PR #25388
(and #25889).
---
addons/crm/data/crm_lead_data.xml | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/addons/crm/data/crm_lead_data.xml b/addons/crm/data/crm_lead_data.xml
index a3398a1adfc..f4e15d318b5 100644
--- a/addons/crm/data/crm_lead_data.xml
+++ b/addons/crm/data/crm_lead_data.xml
@@ -71,22 +71,6 @@
${(not object.partner_id and object.email_from)|safe}
-
- Lead: Reminder
-
-
- admin@example.com
- ${(object.user_id != False and object.user_id.email)|safe}
- Reminder: Lead ${object.name} from ${object.partner_id != False and object.partner_id.name or object.contact_name}
- Hello ${object.user_id and object.user_id.name or ''},
-
The opportunity ${object.name} did not have any activity since at least 5 days.
-%if object.description:
-
Here is the description about the opportunity :
${object.description}
-%endif
-
Thank you!
-]]>
-
From 744261a2effb34515d275219c32d47cbb69a7390 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Fri, 20 Jul 2018 12:16:26 +0200
Subject: [PATCH 03/25] [IMP] mail: add optional encapsulation layout when
sending template-based emails
This commit adds possibility to add a notification layout when sending
an email based on a template using the send_mail method. Purpose of this
task is to allow to send some technical template-based emails using the
default notification layouts defined in mail. It allows to avoid redefining
the whole layout in the template itself.
Target of this commit is some technical templates that are send only by
email. Customer email have currently no way of choosing this notification
layout.
This commit is linked to task ID 1868112 and to PR #25889.
---
addons/mail/models/mail_template.py | 39 +++++++++++++++++++----------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index 211368f0f24..ec27b66e08f 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -405,7 +405,6 @@ class MailTemplate(models.Model):
"""Generates an email from the template for given the given model based on
records given by res_ids.
- :param template_id: id of the template to render.
:param res_id: id of the record to use for rendering the template (model
is taken from template definition)
:returns: a dict containing all relevant fields for creating a new
@@ -487,19 +486,18 @@ class MailTemplate(models.Model):
return multi_mode and results or results[res_ids[0]]
@api.multi
- def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None):
- """Generates a new mail message for the given template and record,
- and schedules it for delivery through the ``mail`` module's scheduler.
+ def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None, notif_layout=False):
+ """ Generates a new mail.mail. Template is rendered on record given by
+ res_id and model coming from template.
- :param int res_id: id of the record to render the template with
- (model is taken from the template)
- :param bool force_send: if True, the generated mail.message is
- immediately sent after being created, as if the scheduler
- was executed for this message only.
- :param dict email_values: if set, the generated mail.message is
- updated with given values dict
- :returns: id of the mail.message that was created
- """
+ :param int res_id: id of the record to render the template
+ :param bool force_send: send email immediately; otherwise use the mail
+ queue (recommended);
+ :param dict email_values: update generated mail with those values to further
+ customize the mail;
+ :param str notif_layout: optional notification layout to encapsulate the
+ generated email;
+ :returns: id of the mail.mail that was created """
self.ensure_one()
Mail = self.env['mail.mail']
Attachment = self.env['ir.attachment'] # TDE FIXME: should remove dfeault_type from context
@@ -513,6 +511,21 @@ class MailTemplate(models.Model):
# add a protection against void email_from
if 'email_from' in values and not values.get('email_from'):
values.pop('email_from')
+ # encapsulate body
+ if notif_layout and values['body_html']:
+ try:
+ template = self.env.ref(notif_layout, raise_if_not_found=True)
+ except ValueError:
+ _logger.warning('QWeb template %s not found when sending template %s. Sending without layouting.' % (notif_layout, self.name))
+ else:
+ record = self.env[self.model].browse(res_id)
+ template_ctx = {
+ 'message': self.env['mail.message'].sudo().new(dict(body=values['body_html'], record_name=record.display_name)),
+ 'model_description': self.env['ir.model']._get(record._name).display_name,
+ 'company': 'company_id' in record and record['company_id'] or self.env.user.company_id,
+ }
+ body = template.render(template_ctx, engine='ir.qweb', minimal_qcontext=True)
+ values['body_html'] = self.env['mail.thread']._replace_local_links(body)
mail = Mail.create(values)
# manage attachments
From 022a1660b44db24f7e4f06257802663e0dd8fcb3 Mon Sep 17 00:00:00 2001
From: Mitali Patel
Date: Wed, 4 Jul 2018 12:13:23 +0530
Subject: [PATCH 04/25] [IMP] mail: clean record name displayed in notification
email and update font size
Purpose is to avoid having '/' in record name. This is generally considered
as being an URL and leads to a specific display in most email readers. In
this commit we therefore remove '/' by '-'.
A use case is the name of payment receipts.
Font sizes in light notification template are also standardized to 13 and
11 px to better match the chatter layout. Emails are still bioutifoul.
This commit is linked to task ID 1843376 (and 1868112) and to PR #25349
(and #25889).
---
addons/mail/data/mail_data.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml
index 7b5196d271d..4c3848f1199 100644
--- a/addons/mail/data/mail_data.xml
+++ b/addons/mail/data/mail_data.xml
@@ -168,7 +168,7 @@
From 0d83edc9b022c8895b6684a306408ed401ccffac Mon Sep 17 00:00:00 2001
From: Pratima Gupta
Date: Mon, 18 Jun 2018 12:07:54 +0530
Subject: [PATCH 05/25] [IMP] account, l10n_be_invoice: make templates more
modern and updated with Odoo guidelines
In this commit we improve templates used in account and l10n_be. 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 1843395 and 1843376 (and 1868112) and to
PR #25294 and #25349 (and #25889).
Co-Authored-By: Mitali Patel
---
addons/account/data/payment_receipt_data.xml | 35 +++++----
.../data/mail_template_data.xml | 72 ++++++++-----------
2 files changed, 53 insertions(+), 54 deletions(-)
diff --git a/addons/account/data/payment_receipt_data.xml b/addons/account/data/payment_receipt_data.xml
index d3c02413732..e05a711ece0 100644
--- a/addons/account/data/payment_receipt_data.xml
+++ b/addons/account/data/payment_receipt_data.xml
@@ -4,24 +4,32 @@
- Payment Receipt - Send by Email
+ Payment Receipt: Send by email
+ ${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' })${object.partner_id.id}
-
-
+
+
+
+ Dear ${object.partner_id.name}
+ Thank you for your payment.
+ Here is your payment receipt ${(object.name or '').replace('/','-')} amounting
+ to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}.
+
+ Do not hesitate to contact us if you have any question.
+
+ Best regards,
+ % if user and user.signature:
+ ${user.signature | safe}
+ % endif
+
+
+${(object.name or '').replace('/','-')}${object.partner_id.lang}
-
-
Dear ${object.partner_id.name},
-
Thank you for your payment. Here is your payment receipt ${(object.name or '').replace('/','-')} amounting to ${format_amount(object.amount, object.currency_id)} from ${object.company_id.name}.
-
If you have any questions, please do not hesitate to contact us.
-
Best regards,
-% if user and user.signature:
-${user.signature | safe}
-% endif
-
-
+
+
diff --git a/addons/l10n_be_invoice_bba/data/mail_template_data.xml b/addons/l10n_be_invoice_bba/data/mail_template_data.xml
index b7110f157e7..e12f7745b91 100644
--- a/addons/l10n_be_invoice_bba/data/mail_template_data.xml
+++ b/addons/l10n_be_invoice_bba/data/mail_template_data.xml
@@ -2,47 +2,37 @@
- Dear ${object.partner_id.name}
-% set access_action = object.with_context(force_website=True).get_access_action()
-% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'
-% set access_url = is_online and object.get_mail_url() or '/report/pdf/account.report_invoice/' + str(object.id)
-
-% if object.partner_id.parent_id:
- (${object.partner_id.parent_id.name})
-% endif
-,
-
Here is your
-% if object.number:
-invoice ${object.number}
-% else:
-pro-forma invoice
-% endif
-% if object.origin:
-(with reference: ${object.origin} )
-% endif
-amounting in ${format_amount(object.amount_total, object.currency_id)}
-from ${object.company_id.name}.
-
+ Here is, in attachment, your
+ % if object.number:
+ invoice ${object.number}
+ % else:
+ invoice
+ %endif
+ % if object.origin:
+ (with reference: ${object.origin} )
+ % endif
+ amounting in ${format_amount(object.amount_total, object.currency_id)}
+ from ${object.company_id.name}.
+ % if object.state=='paid':
+ This invoice is already paid.
+ % else:
+ Please remit payment at your earliest convenience.
+ % if object.reference_type == 'bba' and object.reference:
+ Please use the following communication for your payment: ${object.reference}.
+ % endif
+
+ Do not hesitate to contact us if you have any question.
+
+
+
From fa9382a33c551a7e00644b5b314a4c1378a748da Mon Sep 17 00:00:00 2001
From: Dipalee Bhalodia
Date: Tue, 12 Jun 2018 18:15:49 +0530
Subject: [PATCH 06/25] [IMP] auth_signup: make templates more modern and
updated with Odoo guidelines
In this commit we improve templates used in auth_signup. 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 1843361 (and 1868112) and to PR #25299
(and #25889).
---
addons/auth_signup/data/auth_signup_data.xml | 388 ++++++++++++-------
1 file changed, 248 insertions(+), 140 deletions(-)
diff --git a/addons/auth_signup/data/auth_signup_data.xml b/addons/auth_signup/data/auth_signup_data.xml
index 32bde965ba0..bf5dc18e9be 100644
--- a/addons/auth_signup/data/auth_signup_data.xml
+++ b/addons/auth_signup/data/auth_signup_data.xml
@@ -1,40 +1,96 @@
-
Auth Signup: Reset Password
- ]]>
- ${object.email|safe}Password reset
-
-
+ A password reset was requested for the Odoo account linked to this email.
+ You may change your password by following this link which will remain valid during 24 hours:
+
- Never heard of Odoo? It’s a all-in-one business software loved by 3+ million users. It will considerably improve your experience at work and increase your productivity.
-
-
- Have a look at the Odoo Tour to discover the tool.
-
+ % set website_url = object.env['ir.config_parameter'].sudo().get_param('web.base.url')
+ Your Odoo domain is: ${website_url}
+ Your sign in email is: ${object.email}
+ Never heard of Odoo? It’s a all-in-one business software loved by 3+ million users. It will considerably improve your experience at work and increase your productivity.
+
+ Have a look at the Odoo Tour to discover the tool.
+
+ Enjoy Odoo!
+ -- The ${object.company_id.name} Team
+
+
From a35a7f59315c1a4e124fa516c438a3bcc64fda5b Mon Sep 17 00:00:00 2001
From: Pratima Gupta
Date: Mon, 23 Jul 2018 13:28:48 +0200
Subject: [PATCH 07/25] [MOV] calendar: move mail data in their own files
It lessen noise on other data when updating templates. As they are subject
to frequent changes it is better to have them located in a single file.
It is also easier to find when searching for mail templates. This allows
calendar to comply more with the guidelines.
By the way also remove a falsy comment in calendar data.
This commit is linked to task ID 1843136 (and 1868112) and to PR #25412
(and #25889).
---
addons/calendar/__manifest__.py | 1 +
addons/calendar/data/calendar_data.xml | 279 +------------------------
addons/calendar/data/mail_data.xml | 279 +++++++++++++++++++++++++
3 files changed, 281 insertions(+), 278 deletions(-)
create mode 100644 addons/calendar/data/mail_data.xml
diff --git a/addons/calendar/__manifest__.py b/addons/calendar/__manifest__.py
index 47707a492de..0d623bfe651 100644
--- a/addons/calendar/__manifest__.py
+++ b/addons/calendar/__manifest__.py
@@ -28,6 +28,7 @@ If you need to manage your meetings, you should install the CRM module.
'security/calendar_security.xml',
'data/calendar_cron.xml',
'data/calendar_data.xml',
+ 'data/mail_data.xml',
'views/mail_activity_views.xml',
'views/calendar_templates.xml',
'views/calendar_views.xml',
diff --git a/addons/calendar/data/calendar_data.xml b/addons/calendar/data/calendar_data.xml
index 8f4a4774f0e..29083593e32 100644
--- a/addons/calendar/data/calendar_data.xml
+++ b/addons/calendar/data/calendar_data.xml
@@ -1,8 +1,6 @@
-
-
Invitationcalendar.event
@@ -51,280 +49,5 @@
hoursemail
-
-
- Calendar: Meeting Invitation
- ${object.event_id.user_id.email or ''}
- ${object.event_id.name} invitation
-
- ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}
- ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }
-
-
-% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}
-
- Dear ${object.common_name},
- ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.
-
-
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
- % for attendee in object.event_id.attendee_ids:
-
-
- % if attendee.common_name != object.common_name:
- ${attendee.common_name}
- % else:
- You
- % endif
-
- % endfor
-
-
-
-
-
-
-
-
]]>
-
-
-
- Calendar: Date updated
- ${object.event_id.user_id.email or ''}
- ${object.event_id.name}: Date updated
-
- ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}
- ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }
-
-
-% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}
-
- Dear ${object.common_name},
- The date of the meeting has been upated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
-
-
-
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
+ Dear ${object.common_name},
+ ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.
+
+
+
+ ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
+
+ ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
+
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
+ % for attendee in object.event_id.attendee_ids:
+
+
+ % if attendee.common_name != object.common_name:
+ ${attendee.common_name}
+ % else:
+ You
+ % endif
+
+ % endfor
+
+
+
+
+
+
+
+
]]>
+
+
+
+ Calendar: Date updated
+ ${object.event_id.user_id.email or ''}
+ ${object.event_id.name}: Date updated
+
+ ${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}
+ ${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }
+
+
+% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}
+
+ Dear ${object.common_name},
+ The date of the meeting has been upated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
+
+
+
+
+ ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
+
+ ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
+
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
+
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
+ % for attendee in object.event_id.attendee_ids:
+
+
+ % if attendee.common_name != object.common_name:
+ ${attendee.common_name}
+ % else:
+ You
+ % endif
+
+ % endfor
+
+
+
+
+
+
+
+
]]>
+
+
+
From b65329270ffd9826f629a292993c3232b2c0d179 Mon Sep 17 00:00:00 2001
From: Pratima Gupta
Date: Mon, 23 Jul 2018 16:56:58 +0200
Subject: [PATCH 08/25] [IMP] calendar: update registration model description
This new name is much easier to understand and nicer on emails you receive
by Odoo.
This commit is linked to task ID 1843136 (and 1868112) and to PR #25412
(and #25889).
---
addons/calendar/models/calendar.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py
index 8deecf4d657..6da1e4368e4 100644
--- a/addons/calendar/models/calendar.py
+++ b/addons/calendar/models/calendar.py
@@ -111,7 +111,7 @@ class Attendee(models.Model):
_name = 'calendar.attendee'
_rec_name = 'common_name'
- _description = 'Attendee information'
+ _description = 'Calendar Registration'
def _default_access_token(self):
return uuid.uuid4().hex
From 89152235177151a58bc54d0d70d96e421a252915 Mon Sep 17 00:00:00 2001
From: Pratima Gupta
Date: Tue, 19 Jun 2018 11:17:43 +0530
Subject: [PATCH 09/25] [IMP] calendar: make templates more modern and updated
with Odoo guidelines
In this commit we improve templates used in calendar. 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 1843136 (and 1868112) and to PR #25412
(and #25889).
---
addons/calendar/data/mail_data.xml | 476 ++++++++++++++---------------
addons/calendar/models/calendar.py | 2 +-
2 files changed, 226 insertions(+), 252 deletions(-)
diff --git a/addons/calendar/data/mail_data.xml b/addons/calendar/data/mail_data.xml
index c7b1dafcea7..a4e2fa46907 100644
--- a/addons/calendar/data/mail_data.xml
+++ b/addons/calendar/data/mail_data.xml
@@ -3,277 +3,251 @@
Calendar: Meeting Invitation
- ${object.event_id.user_id.email or ''}
- ${object.event_id.name} invitation
+ Invitation to ${object.event_id.name}
+ ${object.event_id.user_id.email or ''}${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }
-
-
-% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}
-
+ % for attendee in object.event_id.attendee_ids:
+
+
+ % if attendee.common_name != object.common_name:
+ ${attendee.common_name}
+ % else:
+ You
+ % endif
+
+ % endfor
+
+
+
+
+
+ Thank you,
+
+ % if object.event_id.user_id and object.event_id.user_id.signature:
+ ${object.event_id.user_id.signature | safe}
+ % endif
-
-
-
-
-
Invitation to ${object.event_id.name}
-
- Dear ${object.common_name},
- ${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.
-
-
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
- % for attendee in object.event_id.attendee_ids:
-
-
- % if attendee.common_name != object.common_name:
- ${attendee.common_name}
- % else:
- You
- % endif
-
- % endfor
-
-
-
-
-
-
-
-
]]>
+
+
+ Calendar: Date updated
- ${object.event_id.user_id.email or ''}
- ${object.event_id.name}: Date updated
+ ${object.event_id.name}: Date updated
+ ${object.event_id.user_id.email or ''}${('' if object.partner_id and object.partner_id.email and object.partner_id.email==object.email else object.email|safe)}${object.partner_id and object.partner_id.email and object.partner_id.email==object.email and object.partner_id.id or False }
-
-
-% set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}
-
+ The date of the meeting has been updated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
+
+ % for attendee in object.event_id.attendee_ids:
+
+
+ % if attendee.common_name != object.common_name:
+ ${attendee.common_name}
+ % else:
+ You
+ % endif
+
+ % endfor
+
+
+
+
+
+ Thank you,
+
+ % if object.event_id.user_id and object.event_id.user_id.signature:
+ ${object.event_id.user_id.signature | safe}
+ % endif
-
-
-
-
-
${object.event_id.name} date updated
-
- Dear ${object.common_name},
- The date of the meeting has been upated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
-
-
-
-
- ${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
- ${object.event_id.get_interval('day', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
-
${object.event_id.get_interval('month', tz=object.partner_id.tz if not object.event_id.allday else None)}
-
${not object.event_id.allday and object.event_id.get_interval('time', tz=object.partner_id.tz) or ''}
- % for attendee in object.event_id.attendee_ids:
-
-
- % if attendee.common_name != object.common_name:
- ${attendee.common_name}
- % else:
- You
- % endif
-
- % endfor
-
-
-
-
-
-
-
-
]]>
+
+
+
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py
index 6da1e4368e4..26db5ff6cbe 100644
--- a/addons/calendar/models/calendar.py
+++ b/addons/calendar/models/calendar.py
@@ -195,7 +195,7 @@ class Attendee(models.Model):
if attendee.email or attendee.partner_id.email:
# FIXME: is ics_file text or bytes?
ics_file = ics_files.get(attendee.event_id.id)
- mail_id = invitation_template.send_mail(attendee.id)
+ mail_id = invitation_template.send_mail(attendee.id, notif_layout='mail.mail_notification_light')
vals = {}
if ics_file:
From b26679ce16187db03f10e96cdb5ac7175b4398b4 Mon Sep 17 00:00:00 2001
From: Mitali Patel
Date: Mon, 18 Jun 2018 18:15:53 +0530
Subject: [PATCH 10/25] [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.
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',
From 2ab0fc6bf389e7e7536c35e6ba01a9bf12843b37 Mon Sep 17 00:00:00 2001
From: Dipalee Bhalodia
Date: Mon, 18 Jun 2018 18:01:05 +0530
Subject: [PATCH 11/25] [IMP] hr: make templates more modern and updated with
Odoo guidelines
In this commit we improve templates used in hr. 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 1843361 (and 1868112) and to PR #25299
(and #25889).
---
addons/hr/data/hr_data.xml | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/addons/hr/data/hr_data.xml b/addons/hr/data/hr_data.xml
index 8ce5b78ec72..58afb0ede52 100644
--- a/addons/hr/data/hr_data.xml
+++ b/addons/hr/data/hr_data.xml
@@ -19,14 +19,42 @@
- HR: unknown employee bounce
+ HR: mailgateway unknown employee bounce
+ Your document has not been created${user.email}${ctx['email_to']|safe}
+
+
+
+
+
+
+
+
+
+ Hi,
+ Your document has not been created because your email address is not recognized. Please send emails with the email address recorded on your employee information, or contact your HR manager.
+
+ ${user.lang}
-
-
+
From 323eb1861b5394e815d0deb2c1446686551375e5 Mon Sep 17 00:00:00 2001
From: Hetashree Chauhan
Date: Fri, 15 Jun 2018 16:12:00 +0530
Subject: [PATCH 12/25] [IMP] hr_recruitment: make templates more modern and
updated with Odoo guidelines
In this commit we improve templates used in hr_recruitment. 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 1843122 (and 1868112) and to PR #25295
(and #25889).
---
.../data/hr_recruitment_data.xml | 596 ++++++++----------
addons/hr_recruitment/models/hr_employee.py | 3 +-
.../hr_recruitment/models/hr_recruitment.py | 6 +-
3 files changed, 255 insertions(+), 350 deletions(-)
diff --git a/addons/hr_recruitment/data/hr_recruitment_data.xml b/addons/hr_recruitment/data/hr_recruitment_data.xml
index 0a5a6fad082..8eac525a86e 100644
--- a/addons/hr_recruitment/data/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/data/hr_recruitment_data.xml
@@ -10,393 +10,293 @@
Applicant: Refuse
+ Your Job Application: ${object.job_id.name | safe}${(not object.partner_id and object.email_from or '') | safe}${object.partner_id.id or ''}
- ${object.partner_id.lang or ''}
-
-
-
-
- % if 'website_url' in object.job_id and object.job_id.website_url:
- Job Description
- % endif
-
-
-
-
-
-
-
-
- Hi,
-
- Thank you for your interest in joining the
- ${object.company_id.name} team. We wanted to
- let you know that, although your resume is competitive,
- our hiring team reviewed your application and did not
- select it for further consideration.
-
- Please note that recruiting is hard, and we can do
- mistake. Do not hesitate to reply to this email if you
- think we did a mistake, or if you want more information
- about our decision.
-
- We will, however, keep your resume on record and get in
- touch with you about future opportunities that may be a
- better fit for your skills and experience.
-
-
- We wish you all the best in your job search and hope we
- will have the chance to consider you for another role
- in the future.
-
-
- Regards,
-
-
-
--
+
+
+
+
+
+ Hello,
+ Thank you for your interest in joining the
+ ${object.company_id.name} team. We wanted to
+ let you know that, although your resume is competitive,
+ our hiring team reviewed your application and did not
+ select it for further consideration.
+
+ Please note that recruiting is hard, and we can do
+ mistake. Do not hesitate to reply to this email if you
+ think we did a mistake, or if you want more information
+ about our decision.
+
+ We will, however, keep your resume on record and get in
+ touch with you about future opportunities that may be a
+ better fit for your skills and experience.
+
+ We wish you all the best in your job search and hope we
+ will have the chance to consider you for another role
+ in the future.
+
+ Thank you,
+
% if object.user_id:
+ -- ${object.user_id.name}
Email: ${object.user_id.email or ''}
Phone: ${object.user_id.phone or ''}
% else:
+ --
${object.company_id.name}
The HR Team
% endif
-
-
-
-
-
-
-
-
-
-
Sent by ${object.company_id.name}
- % if 'website_url' in object.job_id and object.job_id.website_url:
-
- % if 'website_url' in object.job_id and object.job_id.website_url:
- Job Description
- % endif
-
-
-
-
-
-
-
-
-
Congratulations!
-
Your resume has been positively reviewed.
-
-
-
-
- We just reviewed your resume, and it caught our
- attention. As we think you might be great for the
- position, your application has been short listed for a
- call or an interview.
-
-
- % if object.user_id:
-
- You will soon be contacted by:
-
-
-
-
-
-
- ${object.user_id.name}
- Email: ${object.user_id.email or ''}
- Phone: ${object.user_id.phone or ''}
-
-
-
- % endif
-
- See you soon,
-
- --
- Odoo HR Team
-
-
-
-
What is the next step?
-
- We usually answer applications within 3 days.
- The next step is either a call or a meeting in our offices.
-
- Feel free to contact us if you want a faster
- feedback or if you don't get news from us
- quickly enough (just reply to this email).
-
+ We just reviewed your resume, and it caught our
+ attention. As we think you might be great for the
+ position, your application has been short listed for a
+ call or an interview.
+
+ % if 'website_url' in object.job_id and object.job_id.website_url:
+
+ % endif
+ % if object.user_id:
+ You will soon be contacted by:
+
+
+
+
+
+
+ ${object.user_id.name}
+ Email: ${object.user_id.email or ''}
+ Phone: ${object.user_id.phone or ''}
+
+
+
+
+ % endif
+ See you soon,
+
+ --
+ Odoo HR Team
+ % if 'website_url' in object.job_id and object.job_id.website_url
+ Discover all our jobs.
+ % endif
+
-
- ]]>
+
+
What is the next step?
+ We usually answer applications within 3 days.
+
+ The next step is either a call or a meeting in our offices.
+
+ Feel free to contact us if you want a faster
+ feedback or if you don't get news from us
+ quickly enough (just reply to this email).
+
+
+
+
+
+
+ ${object.partner_id.lang or ''}Applicant: Welcome new employee
- Welcome ${object.name}
- Dear all,
-
I’m very pleased to announce that ${object.name} will be
-joining us as a ${object.job_id.name}
-%if object.department_id:
- in ${object.department_id.name}.
-%endif
-.
-
Please welcome him/her and help him/her finding his/her marks.
]]>
+ Welcome ${object.name}
+
+
+ Hello all,
+ I’m very pleased to announce that ${object.name} will be
+ joining us as a ${object.job_id.name}
+ %if object.department_id:
+ in ${object.department_id.name}.
+ %endif
+
+ Please welcome him/her and help him/her finding his/her marks.
+
diff --git a/addons/hr_recruitment/models/hr_employee.py b/addons/hr_recruitment/models/hr_employee.py
index 5c88db5efa0..0d90897631e 100644
--- a/addons/hr_recruitment/models/hr_employee.py
+++ b/addons/hr_recruitment/models/hr_employee.py
@@ -35,5 +35,6 @@ class HrEmployee(models.Model):
subject = MailTemplate.render_template(template_new_employee.subject, 'hr.employee', self.id)
channel_all_employees.message_post(
body=body_html, subject=subject,
- subtype='mail.mt_comment')
+ subtype='mail.mt_comment',
+ notif_layout='mail.mail_notification_light')
return True
diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py
index 898a5234939..c13fb3e417d 100644
--- a/addons/hr_recruitment/models/hr_recruitment.py
+++ b/addons/hr_recruitment/models/hr_recruitment.py
@@ -338,7 +338,11 @@ class Applicant(models.Model):
applicant = self[0]
changes, dummy = tracking[applicant.id]
if 'stage_id' in changes and applicant.stage_id.template_id:
- res['stage_id'] = (applicant.stage_id.template_id, {'composition_mode': 'mass_mail'})
+ res['stage_id'] = (applicant.stage_id.template_id, {
+ 'auto_delete_message': True,
+ 'subtype_id': self.env['ir.model.data'].xmlid_to_res_id('mail.mt_note'),
+ 'notif_layout': 'mail.mail_notification_light'
+ })
return res
@api.multi
From d5437330937a1387a6ed4e3684cd104e8d37090b Mon Sep 17 00:00:00 2001
From: Hetashree Chauhan
Date: Fri, 13 Jul 2018 14:14:12 +0200
Subject: [PATCH 13/25] [REM] hr_recruitment: remove broadcast of new employees
on hardcoded channel
This is specific and updating the content is not easy for non technical
people. As same result can be achieved with a server action based on
employee creation it has been decided to remove the broadcast, and therefore
the template and code linked to it.
This commit is linked to task ID 1843122 (and 1868112) and to PR #25295
(and #25889).
---
.../data/hr_recruitment_data.xml | 19 -------------------
addons/hr_recruitment/models/hr_employee.py | 17 -----------------
.../hr_recruitment/models/hr_recruitment.py | 1 -
3 files changed, 37 deletions(-)
diff --git a/addons/hr_recruitment/data/hr_recruitment_data.xml b/addons/hr_recruitment/data/hr_recruitment_data.xml
index 8eac525a86e..786a623cd2e 100644
--- a/addons/hr_recruitment/data/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/data/hr_recruitment_data.xml
@@ -282,25 +282,6 @@
${object.partner_id.lang or ''}
-
- Applicant: Welcome new employee
-
- Welcome ${object.name}
-
-
- Hello all,
- I’m very pleased to announce that ${object.name} will be
- joining us as a ${object.job_id.name}
- %if object.department_id:
- in ${object.department_id.name}.
- %endif
-
- Please welcome him/her and help him/her finding his/her marks.
-
-
-
-
-
Graduate1
diff --git a/addons/hr_recruitment/models/hr_employee.py b/addons/hr_recruitment/models/hr_employee.py
index 0d90897631e..73104b1a31f 100644
--- a/addons/hr_recruitment/models/hr_employee.py
+++ b/addons/hr_recruitment/models/hr_employee.py
@@ -21,20 +21,3 @@ class HrEmployee(models.Model):
def _search_newly_hired_employee(self, operator, value):
applicants = self.env['hr.applicant'].search([('job_id.state', '=', 'recruit')])
return [('id', 'in', applicants.ids)]
-
- @api.multi
- def _broadcast_welcome(self):
- """ Broadcast the welcome message to all users in the employee company. """
- self.ensure_one()
- IrModelData = self.env['ir.model.data']
- channel_all_employees = IrModelData.xmlid_to_object('mail.channel_all_employees')
- template_new_employee = IrModelData.xmlid_to_object('hr_recruitment.email_template_data_applicant_employee')
- if template_new_employee:
- MailTemplate = self.env['mail.template']
- body_html = MailTemplate.render_template(template_new_employee.body_html, 'hr.employee', self.id)
- subject = MailTemplate.render_template(template_new_employee.subject, 'hr.employee', self.id)
- channel_all_employees.message_post(
- body=body_html, subject=subject,
- subtype='mail.mt_comment',
- notif_layout='mail.mail_notification_light')
- return True
diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py
index c13fb3e417d..67ca1548bfd 100644
--- a/addons/hr_recruitment/models/hr_recruitment.py
+++ b/addons/hr_recruitment/models/hr_recruitment.py
@@ -449,7 +449,6 @@ class Applicant(models.Model):
applicant.job_id.message_post(
body=_('New Employee %s Hired') % applicant.partner_name if applicant.partner_name else applicant.name,
subtype="hr_recruitment.mt_job_applicant_hired")
- employee._broadcast_welcome()
else:
raise UserError(_('You must define an Applied Job and a Contact Name for this applicant.'))
From 9d0962cb03ed38029b86b7b938c8505218174b32 Mon Sep 17 00:00:00 2001
From: Dipalee Bhalodia
Date: Mon, 23 Jul 2018 12:22:26 +0200
Subject: [PATCH 14/25] [IMP] portal: always send creation / connection email
to new portal users
Currently it is embedded in a strange condition about reactivating an
existing user or adding the portal group. Let us send the connection
email each time as it contains basic information on the account and is
useful for the newly created or activated user.
This commit is linked to task ID 1843361 (and 1868112) and to PR #25299
(and #25889).
---
addons/portal/wizard/portal_wizard.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py
index 6fa550a184f..ee5b82eecda 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -143,7 +143,7 @@ class PortalWizardUser(models.TransientModel):
wizard_user.user_id.write({'active': True, 'groups_id': [(4, group_portal.id)]})
# prepare for the signup process
wizard_user.user_id.partner_id.signup_prepare()
- wizard_user.with_context(active_test=True)._send_email()
+ wizard_user.with_context(active_test=True)._send_email()
wizard_user.refresh()
else:
# remove the user (if it exists) from the portal group
From 6f7068958138137930b5d95b743843231a02ece7 Mon Sep 17 00:00:00 2001
From: Dipalee Bhalodia
Date: Mon, 18 Jun 2018 10:45:24 +0530
Subject: [PATCH 15/25] [IMP] portal: make templates more modern and updated
with Odoo guidelines
In this commit we improve templates used in portal. 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 1843361 (and 1868112) and to PR #25299
(and #25889).
---
addons/portal/data/portal_data.xml | 112 ++++++++++++++++++++++-------
1 file changed, 86 insertions(+), 26 deletions(-)
diff --git a/addons/portal/data/portal_data.xml b/addons/portal/data/portal_data.xml
index 6539d154080..0cab34b3c01 100644
--- a/addons/portal/data/portal_data.xml
+++ b/addons/portal/data/portal_data.xml
@@ -5,34 +5,94 @@
Portal: new user
- ${object.partner_id.email}
- Your Odoo account at ${user.company_id.name}
+ Your Odoo account at ${object.user_id.company_id.name}
+ ${object.user_id.email_formatted | safe}
+
+
+
+
+
+
+
+
+
+ Your Account
+
+ ${object.user_id.name}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dear ${object.user_id.name or ''},
+ You have been given access to ${object.user_id.company_id.name}'s portal.
+ Your login account data is:
+
+
From d0d0ba0d25b8605b9a99ecc1a79f84de8870afed Mon Sep 17 00:00:00 2001
From: Shubham Johar
Date: Mon, 18 Jun 2018 14:00:10 +0530
Subject: [PATCH 16/25] [IMP] purchase: make templates more modern and updated
with Odoo guidelines
In this commit we improve templates used in purchase. 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 1843151 (and 1868112) and to PR #25346
(and #25889).
---
addons/purchase/data/mail_template_data.xml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml
index 16fa3861f1d..b5f7fb33024 100644
--- a/addons/purchase/data/mail_template_data.xml
+++ b/addons/purchase/data/mail_template_data.xml
@@ -4,8 +4,8 @@
Purchase Order: Send RFQ
- ${object.create_uid.email_formatted | safe}${object.company_id.name} Order (Ref ${object.name or 'n/a' })
+ ${object.create_uid.email_formatted | safe}${object.partner_id.id}
@@ -40,8 +40,8 @@
Purchase Order: Send PO
- ${object.create_uid.email_formatted | safe}${object.company_id.name} Order (Ref ${object.name or 'n/a' })
+ ${object.create_uid.email_formatted | safe}${object.partner_id.id}
@@ -62,6 +62,8 @@
from ${object.company_id.name}.
Do not hesitate to contact us if you have any question.
+
+ Best regards,
From c1f250d5b165ca1f1fcf1b9df56f5fd181ff1a91 Mon Sep 17 00:00:00 2001
From: Pratima Gupta
Date: Mon, 18 Jun 2018 12:29:43 +0530
Subject: [PATCH 17/25] [IMP] repair: make templates more modern and updated
with Odoo guidelines
In this commit we improve templates used in repair. 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 1843395 (and 1868112) and to PR #25294
(and #25889).
---
addons/repair/data/repair_data.xml | 44 ++++++++++++++++--------------
addons/repair/models/repair.py | 3 +-
2 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/addons/repair/data/repair_data.xml b/addons/repair/data/repair_data.xml
index 4b62c7aacb9..136a20d0c82 100644
--- a/addons/repair/data/repair_data.xml
+++ b/addons/repair/data/repair_data.xml
@@ -1,31 +1,35 @@
-
-
- Repair Quotation - Send by Email
- ${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}
- ${object.partner_id.name} Repair Orders (Ref ${object.name or 'n/a' })
- ${object.partner_id.id}
+ Repair Quotation: Send by email
+ ${object.partner_id.name} Repair Orders (Ref ${object.name or 'n/a' })
+ ${(object.create_uid.email and '%s <%s>' % (object.create_uid.name, object.create_uid.email) or '')|safe}
+ ${object.partner_id.id}
+
+
+
+ Hello ${object.partner_id.name},
+ Here is your repair order ${doc_name} ${object.name}
+ % if object.origin:
+ (with reference: ${object.origin} )
+ % endif
+ % if object.invoice_method != 'none':
+ amounting in ${format_amount(object.amount_total, object.pricelist_id.currency_id)}.
+ % else:
+ .
+ % endif
+ You can reply to this email if you have any questions.
+
+ Thank you,
+
+
${(object.name or '').replace('/','_')}${object.partner_id.lang}
-
-
Dear ${object.partner_id.name}
-
- Here is your repair order ${doc_name} ${object.name}
- % if object.origin:
- (with reference: ${object.origin} )
- % endif
- % if object.invoice_method != 'none':
- amounting in ${format_amount(object.amount_total, object.pricelist_id.currency_id)}.
- % endif
-
-
You can reply to this email if you have any questions.
-
Thank you,
-
+
+
diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py
index 95581a5e990..b0f188fd920 100644
--- a/addons/repair/models/repair.py
+++ b/addons/repair/models/repair.py
@@ -256,7 +256,8 @@ class Repair(models.Model):
'default_res_id': self.id,
'default_use_template': bool(template_id),
'default_template_id': template_id,
- 'default_composition_mode': 'comment'
+ 'default_composition_mode': 'comment',
+ 'custom_layout': 'mail.mail_notification_light',
}
return {
'type': 'ir.actions.act_window',
From 158fa9681a791bfa51b7ad493ddb7e1c7081a963 Mon Sep 17 00:00:00 2001
From: Haresh Kansara
Date: Fri, 20 Jul 2018 13:48:13 +0200
Subject: [PATCH 18/25] [IMP] survey: add optional encapsulation layout when
sending survey emails
This commit adds possibility to add a notification layout when sending
an email in survey using their specific composer. Purpose of this task is to
allow to send some technical template-based emails using the default
notification layouts defined in mail. It allows to avoid redefining the whole
layout in the template itself. This way email body content is simpler.
This commit is linked to task ID 1843224 (and 1868112) and to PR #25313
(and #25889).
---
addons/survey/tests/test_survey.py | 4 ++-
.../wizard/survey_email_compose_message.py | 26 +++++++++++++++++++
.../wizard/survey_email_compose_message.xml | 2 +-
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/addons/survey/tests/test_survey.py b/addons/survey/tests/test_survey.py
index c767b2ece4d..03c5bbbc5f4 100644
--- a/addons/survey/tests/test_survey.py
+++ b/addons/survey/tests/test_survey.py
@@ -124,7 +124,9 @@ class TestSurvey(TransactionCase):
default_survey_id=correct_survey.id,
default_use_template=bool(template),
default_template_id=template and template.id or False,
- default_composition_mode='comment')
+ default_composition_mode='comment',
+ notif_layout='mail.mail_notification_light',
+ )
self.assertDictEqual(action, {
'type': 'ir.actions.act_window',
diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py
index 80884543585..f57cc226b6c 100644
--- a/addons/survey/wizard/survey_email_compose_message.py
+++ b/addons/survey/wizard/survey_email_compose_message.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+import logging
import re
import uuid
@@ -10,9 +11,12 @@ from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import pycompat
+_logger = logging.getLogger(__name__)
+
emails_split = re.compile(r"[;,\n\r]+")
email_validator = re.compile(r"[^@]+@[^@]+\.[^@]+")
+
class SurveyMailComposeMessage(models.TransientModel):
_name = 'survey.mail.compose.message'
_inherit = 'mail.compose.message'
@@ -73,6 +77,11 @@ class SurveyMailComposeMessage(models.TransientModel):
#------------------------------------------------------
# Wizard validation and send
#------------------------------------------------------
+
+ @api.multi
+ def send_mail_action(self):
+ return self.send_mail()
+
@api.multi
def send_mail(self, auto_commit=False):
""" Process the wizard content and proceed with sending the related
@@ -81,6 +90,7 @@ class SurveyMailComposeMessage(models.TransientModel):
SurveyUserInput = self.env['survey.user_input']
Partner = self.env['res.partner']
Mail = self.env['mail.mail']
+ notif_layout = self.env.context.get('notif_layout', self.env.context.get('custom_layout'))
def create_response_and_send_mail(wizard, token, partner_id, email):
""" Create one mail by recipients and replace __URL__ by link with identification token """
@@ -106,6 +116,22 @@ class SurveyMailComposeMessage(models.TransientModel):
values['recipient_ids'] = [(4, partner_id)]
else:
values['email_to'] = email
+
+ # optional support of notif_layout in context
+ if notif_layout:
+ try:
+ template = self.env.ref(notif_layout, raise_if_not_found=True)
+ except ValueError:
+ _logger.warning('QWeb template %s not found when sending survey mails. Sending without layouting.' % (notif_layout))
+ else:
+ template_ctx = {
+ 'message': self.env['mail.message'].sudo().new(dict(body=values['body_html'], record_name=wizard.survey_id.title)),
+ 'model_description': self.env['ir.model']._get('survey.survey').display_name,
+ 'company': self.env.user.company_id,
+ }
+ body = template.render(template_ctx, engine='ir.qweb', minimal_qcontext=True)
+ values['body_html'] = self.env['mail.thread']._replace_local_links(body)
+
Mail.create(values).send()
def create_token(wizard, partner_id, email):
diff --git a/addons/survey/wizard/survey_email_compose_message.xml b/addons/survey/wizard/survey_email_compose_message.xml
index baa4601b7ea..d79cc269191 100644
--- a/addons/survey/wizard/survey_email_compose_message.xml
+++ b/addons/survey/wizard/survey_email_compose_message.xml
@@ -69,7 +69,7 @@