% set date_begin = format_tz(object.event_id.date_begin, tz='UTC', format='%Y%m%dT%H%M%SZ')
% set date_end = format_tz(object.event_id.date_end, tz='UTC', format='%Y%m%dT%H%M%SZ')
-
-
-
-
-
-
-
- |
-
- % if 'website_url' in object.event_id and object.event_id.website_url:
- View Event
- % endif
- |
-
-
-
-
-
-
- |
-
- Hi,
-
- We are happy to confirm your registration to the event:
-
-
- - Event:
+
+
+
+
+
+
+
+ Your registration
+
+ ${object.name}
+
+ |
+
+ |
+
+
+ |
+
+ |
+
+
+
+
+
+
+
+ Hello ${object.name or ''},
+ We are happy to confirm your registration to the event
% if 'website_url' in object.event_id and object.event_id.website_url:
${object.event_id.name}
% else:
${object.event_id.name}
% endif
-
- - Attendee: ${object.name}
-
-
- See you soon,
-
-
-
- --
+ for attendee ${object.name}.
+
+ % if 'website_url' in object.event_id and object.event_id.website_url:
+
+ % endif
+
+ See you soon,
+
+ --
% if object.event_id.organizer_id:
${object.event_id.organizer_id.name}
% else:
The organizers.
% endif
-
-
- |
-
-
- |
-
+ |
+
+
+
+
+
+
+
-
-
+ |
+
|
-
+ |
From ${object.event_id.date_begin_located}
To ${object.event_id.date_end_located}
TZ ${object.event_id.date_tz}
|
% if object.event_id.address_id.country_id.name:
-
-
+ |
+
|
-
+ |
% set location = ''
% if object.event_id.address_id.name:
- ${object.event_id.address_id.name}
+ ${object.event_id.address_id.name}
% endif
% if object.event_id.address_id.street:
- ${object.event_id.address_id.street}
+ ${object.event_id.address_id.street}
% set location = object.event_id.address_id.street
% endif
% if object.event_id.address_id.street2:
- ${object.event_id.address_id.street2}
+ ${object.event_id.address_id.street2}
% set location = '%s, %s' % (location, object.event_id.address_id.street2)
% endif
-
+
% if object.event_id.address_id.city:
${object.event_id.address_id.city},
% set location = '%s, %s' % (location, object.event_id.address_id.city)
@@ -124,163 +141,189 @@
${object.event_id.address_id.zip}
% set location = '%s, %s' % (location, object.event_id.address_id.zip)
% endif
-
+
% if object.event_id.address_id.country_id.name:
- ${object.event_id.address_id.country_id.name}
+ ${object.event_id.address_id.country_id.name}
% set location = '%s, %s' % (location, object.event_id.address_id.country_id.name)
% endif
|
% endif
- % if object.event_id.organizer_id:
-
-
-
- Questions about this event?
- Please contact the organizer:
-
- - ${object.event_id.organizer_id.name}
- % if object.event_id.organizer_id.email
- - Mail: ${object.event_id.organizer_id.email}
- % endif
- % if object.event_id.organizer_id.phone
- - Phone: ${object.event_id.organizer_id.phone}
- % endif
-
-
- |
-
-
- % endif
+ |
+
+
+ |
+ % if object.event_id.organizer_id:
+
+
+ Questions about this event?
+ Please contact the organizer:
+
+ - ${object.event_id.organizer_id.name}
+ % if object.event_id.organizer_id.email
+ - Mail: ${object.event_id.organizer_id.email}
+ % endif
+ % if object.event_id.organizer_id.phone
+ - Phone: ${object.event_id.organizer_id.phone}
+ % endif
+
+
+ |
+ % endif
+ |
- |
-
-
+
+
+
+ |
+ % if object.event_id.address_id:
+ |
+
+ |
+ % endif
+
+ |
+
+
+
+ |
+
+
+
- % if object.event_id.address_id:
-
- % endif
-
-
-
- |
- Sent by ${object.company_id.name}
- % if 'website_url' in object.event_id and object.event_id.website_url:
-
- % endif
- |
-
-
-
-
- ]]>
+ |
+
+
+ ${object.partner_id.lang}
Event: Reminder
- ${(object.event_id.organizer_id.email or object.event_id.user_id.email or '')|safe}
- ${object.partner_id.email or object.email|safe}
- ${object.partner_id.lang}
-
${object.event_id.name}: ${object.get_date_range_str()}
-
+ ${(object.event_id.organizer_id.email or object.event_id.user_id.email or '')|safe}
+ ${('"%s" <%s>' % (object.partner_id.name or object.name, object.partner_id.email or object.email)) | safe}
+
+
+
% set date_begin = format_tz(object.event_id.date_begin, tz='UTC', format='%Y%m%dT%H%M%SZ')
% set date_end = format_tz(object.event_id.date_end, tz='UTC', format='%Y%m%dT%H%M%SZ')
-
-
-
-
-
-
-
- |
-
- % if 'website_url' in object.event_id and object.event_id.website_url:
- View Event
- % endif
- |
-
-
-
-
-
-
- |
-
- Hello,
-
-
+
+
+
+
+
+
+
+ Your registration
+
+ ${object.name}
+
+ |
+
+ |
+
+
+ |
+
+ |
+
+
+
+
+
+
+
+ Hello ${object.name},
We are excited to remind you that the event
% if 'website_url' in object.event_id and object.event_id.website_url:
${object.event_id.name}
% else:
- ${object.event_id.name}
+ ${object.event_id.name}
% endif
- is starting
- ${object.get_date_range_str()}.
-
- We confirm your registration and hope to meet you there,
-
-
- --
+ is starting ${object.get_date_range_str()}.
+
+ % if 'website_url' in object.event_id and object.event_id.website_url:
+
+ % endif
+
+ We confirm your registration and hope to meet you there,
+
+ --
% if object.event_id.organizer_id:
${object.event_id.organizer_id.name}
% else:
The organizers.
% endif
-
-
-
- |
-
-
- |
-
+ |
+
+
+
+
+
+
+
-
-
+ |
+
|
-
+ |
From ${object.event_id.date_begin_located}
To ${object.event_id.date_end_located}
TZ ${object.event_id.date_tz}
|
- % if object.event_id.address_id:
-
-
+ % if object.event_id.address_id.country_id.name:
+ |
+
|
-
+ |
% set location = ''
% if object.event_id.address_id.name:
- ${object.event_id.address_id.name}
+ ${object.event_id.address_id.name}
% endif
% if object.event_id.address_id.street:
- ${object.event_id.address_id.street}
+ ${object.event_id.address_id.street}
% set location = object.event_id.address_id.street
% endif
% if object.event_id.address_id.street2:
- ${object.event_id.address_id.street2}
+ ${object.event_id.address_id.street2}
% set location = '%s, %s' % (location, object.event_id.address_id.street2)
% endif
-
+
% if object.event_id.address_id.city:
${object.event_id.address_id.city},
% set location = '%s, %s' % (location, object.event_id.address_id.city)
@@ -293,71 +336,84 @@
${object.event_id.address_id.zip}
% set location = '%s, %s' % (location, object.event_id.address_id.zip)
% endif
-
+
% if object.event_id.address_id.country_id.name:
- ${object.event_id.address_id.country_id.name}
+ ${object.event_id.address_id.country_id.name}
% set location = '%s, %s' % (location, object.event_id.address_id.country_id.name)
% endif
|
% endif
- % if object.event_id.organizer_id.email:
-
-
-
- Questions about this event?
- Please contact the organizer:
-
- - ${object.event_id.organizer_id.name}
- % if object.event_id.organizer_id.email
- - Mail: ${object.event_id.organizer_id.email}
- % endif
- % if object.event_id.organizer_id.phone
- - Phone: ${object.event_id.organizer_id.phone}
- % endif
-
- |
-
-
- % endif
+ |
+
+
+ |
+ % if object.event_id.organizer_id:
+
+
+ Questions about this event?
+ Please contact the organizer:
+
+ - ${object.event_id.organizer_id.name}
+ % if object.event_id.organizer_id.email
+ - Mail: ${object.event_id.organizer_id.email}
+ % endif
+ % if object.event_id.organizer_id.phone
+ - Phone: ${object.event_id.organizer_id.phone}
+ % endif
+
+
+ |
+ % endif
+ |
- |
-
-
+
+
+
+ |
+ % if object.event_id.address_id:
+ |
+
+ |
+ % endif
+
+ |
+
+
+
+ |
+
+
+
- % if object.event_id.address_id:
-
- % endif
-
-
-
- |
- Sent by ${object.company_id.name}
- % if 'website_url' in object.event_id and object.event_id.website_url:
-
- % endif
- |
-
-
-
-
- ]]>
+ |
+
+
+ ${object.partner_id.lang}
diff --git a/addons/event/models/event.py b/addons/event/models/event.py
index e8d9fe33abe..491459b135a 100644
--- a/addons/event/models/event.py
+++ b/addons/event/models/event.py
@@ -482,6 +482,7 @@ class EventRegistration(models.Model):
default_use_template=bool(template),
default_template_id=template.id,
default_composition_mode='comment',
+ custom_layout="mail.mail_notification_light",
)
return {
'name': _('Compose Email'),
diff --git a/addons/gamification/data/badge.xml b/addons/gamification/data/badge.xml
index 7af0b859048..61112ffbd9a 100644
--- a/addons/gamification/data/badge.xml
+++ b/addons/gamification/data/badge.xml
@@ -1,3 +1,4 @@
+
@@ -47,36 +48,104 @@
${object.user_id.partner_id.id}
${object.user_id.lang}
-
- Congratulations ${object.user_id.name} !
- You just received badge ${object.badge_id.name} !
-
-
-% if object.badge_id.description
-
-
-
-
- |
-
- ${object.badge_id.description}
- |
-
+
+
+
+
+
+
+
+
+ Your Badge
+
+ ${object.badge_id.name}
+
+ |
+
+ |
+
+
+ |
+
+ |
+
+
+
+
+
+
+
+ Congratulations ${object.user_id.name} !
+ You just received badge ${object.badge_id.name} !
+ % if object.badge_id.description
+
+
+
+
+ |
+
+ ${object.badge_id.description}
+ |
+
+
+ % endif
+
+ % if object.sender_id
+ This badge was granted by ${object.sender_id.name}.
+ % endif
+
+ % if object.comment
+ ${object.comment}
+ % endif
+
+ Thank you,
+
+ % if object.sender_id and object.sender_id.signature:
+ ${object.sender_id.signature | safe}
+ % endif
+
+ |
+
+
+ |
+
+ |
+
+
+
+ |
+
+ |
+
+
-% endif
-
-
-
-% if object.sender_id
- This badge was granted by ${object.sender_id.name}.
-% endif
-
-
-% if object.comment
- ${object.comment}
-% endif
-
-
+ |
+
+|
+
+ |
+
+
+
diff --git a/addons/gamification/data/goal_base.xml b/addons/gamification/data/goal_base.xml
index de76683ddc0..3552be22061 100644
--- a/addons/gamification/data/goal_base.xml
+++ b/addons/gamification/data/goal_base.xml
@@ -8,38 +8,40 @@
Reminder for Goal Update
${object.user_id.lang}
-
- Reminder ${object.name}
-
-
- You have not updated your progress for the goal ${object.definition_id.name} (currently reached at ${object.completeness}%) for at least ${object.remind_update_delay} days. Do not forget to do it.
- ]]>
+
+
+ Reminder ${object.name}
+You have not updated your progress for the goal ${object.definition_id.name} (currently reached at ${object.completeness}%) for at least ${object.remind_update_delay} days. Do not forget to do it.
+
+Thank you,
+
+ % if object.challenge_id.manager_id and object.challenge_id.manager_id.signature:
+ ${object.challenge_id.manager_id.signature | safe}
+ % endif
+
Simple Challenge Report Progress
-
-
+
+
-
+ % set record = ctx.get('record')
+ % set company = record and record.company_id or user.company_id
+ % set challenge_lines = ctx.get('challenge_lines', [])
+
-
-
- |
- % if object.visibility_mode == 'ranking':
-
- Leaderboard
- |
- % endif
+
+ % if object.visibility_mode == 'ranking':
+
+ Leaderboard
+ |
+ % endif
+
@@ -49,7 +51,7 @@
|
- Personal Performance
+ Personal Performance
|
@@ -67,11 +69,7 @@
% for line in challenge_lines:
- = 100:
- style="font-weight:bold;"
- % endif
- >
+
${line['name']}
% if line['suffix'] or line['monetary']:
@@ -102,15 +100,15 @@
% for line in challenge_lines:
-
+
|
- Top Achievers for goal ${line['name']}
+ Top Achievers for goal ${line['name']}
|
- % if len(line['goals'])>2:
+ % if len(line['goals']) == 2:
@@ -149,18 +147,16 @@
${goal['name']}
-
${podiumPosition | safe}
-
- ${"%.2f" % goal['current']}
- % if line['suffix'] or line['monetary']:
- ${line['full_suffix']}
- % endif
-
+ ${"%.2f" % goal['current']}
+ % if line['suffix'] or line['monetary']:
+ ${line['full_suffix']}
+ % endif
@@ -187,7 +183,7 @@
(${company.currency_id.symbol})
% endif
- Completeness |
+ Completeness |
|
@@ -220,43 +216,12 @@
% endif
-
-
- |
-
- |
-
-
- |
- Powered by Odoo.
- |
-
-
|
- ]]>
-
-
+
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index 140576da889..ac5286813c3 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -551,7 +551,12 @@ class Challenge(models.Model):
challenge.message_post(
body=body_html,
partner_ids=challenge.mapped('user_ids.partner_id.id'),
- subtype='mail.mt_comment')
+ subtype='mail.mt_comment',
+ notif_layout='mail.mail_notification_light',
+ notif_values={
+ 'model_description': challenge._description.lower(),
+ }
+ )
if challenge.report_message_group_id:
challenge.report_message_group_id.message_post(
body=body_html,
@@ -573,12 +578,21 @@ class Challenge(models.Model):
self.env['gamification.challenge'].message_post(
body=body_html,
partner_ids=[(4, user.partner_id.id)],
- subtype='mail.mt_comment'
+ subtype='mail.mt_comment',
+ notif_layout='mail.mail_notification_light',
+ notif_values={
+ 'model_description': self._description.lower(),
+ }
)
if challenge.report_message_group_id:
challenge.report_message_group_id.message_post(
- body=body_html,
- subtype='mail.mt_comment')
+ body=body_html,
+ subtype='mail.mt_comment',
+ notif_layout='mail.mail_notification_light',
+ notif_values={
+ 'model_description': self._description.lower(),
+ }
+ )
return challenge.write({'last_report_date': fields.Date.today()})
##### Challenges #####
diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 6cd52b2ab81..77966b00c77 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -225,7 +225,11 @@ class Goal(models.Model):
self.env['mail.thread'].message_post(
body=body_html,
partner_ids=[ self.user_id.partner_id.id],
- subtype='mail.mt_comment'
+ subtype='mail.mt_comment',
+ notif_layout='mail.mail_notification_light',
+ notif_values={
+ 'model_description': self._description.lower(),
+ }
)
return {'to_update': True}
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml
index fbbc41f5202..799e8eb6d76 100644
--- a/addons/mail/data/mail_data.xml
+++ b/addons/mail/data/mail_data.xml
@@ -158,20 +158,20 @@
-
-
+
+
-
+
Your
|
-
+
|
@@ -182,7 +182,7 @@
|
-
+
|
|
@@ -195,7 +195,7 @@
-
+
|
|
@@ -218,7 +218,7 @@
-
+
|
Powered by Odoo
|
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 4f89da3b69e..a70e4d65205 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -2076,6 +2076,7 @@ class MailThread(models.AbstractModel):
kwargs['message_type'] = 'notification'
res_id = kwargs.get('res_id', self.ids and self.ids[0] or 0)
res_ids = kwargs.get('res_id') and [kwargs['res_id']] or self.ids
+ notif_layout = kwargs.pop('notif_layout', None)
# Create the composer
composer = self.env['mail.compose.message'].with_context(
@@ -2086,6 +2087,7 @@ class MailThread(models.AbstractModel):
default_model=kwargs.get('model', self._name),
default_res_id=res_id,
default_template_id=template_id,
+ custom_layout=notif_layout,
).create(kwargs)
# Simulate the onchange (like trigger in form the view) only
# when having a template in single-email mode
diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py
index 07bee0bb6e6..d9fb69cecb2 100644
--- a/addons/mail/models/res_partner.py
+++ b/addons/mail/models/res_partner.py
@@ -85,7 +85,7 @@ class Partner(models.Model):
'signature': signature,
'website_url': website_url,
'company': company,
- 'model_name': model_name,
+ 'model_description': model_name,
'record': record,
'record_name': record_name,
'tracking_values': tracking,
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index e16cd71815b..905c7194083 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -198,6 +198,7 @@ class MailComposer(models.TransientModel):
""" Process the wizard content and proceed with sending the related
email(s), rendering any template patterns on the fly if needed. """
notif_layout = self._context.get('custom_layout')
+ ctx_notif_values = self._context.get('notif_values', {})
for wizard in self:
# Duplicate attachments linked to the email.template.
# Indeed, basic mail.compose.message wizard duplicates attachments in mass
@@ -246,14 +247,15 @@ class MailComposer(models.TransientModel):
if wizard.composition_mode == 'mass_mail':
batch_mails |= Mail.create(mail_values)
else:
+ notif_values = dict(
+ add_sign=not bool(wizard.template_id),
+ mail_auto_delete=wizard.template_id.auto_delete if wizard.template_id else False,
+ **ctx_notif_values)
post_params = dict(
message_type=wizard.message_type,
subtype_id=subtype_id,
notif_layout=notif_layout,
- notif_values={
- 'add_sign': not bool(wizard.template_id),
- 'mail_auto_delete': wizard.template_id.auto_delete if wizard.template_id else False,
- },
+ notif_values=notif_values,
**mail_values)
if ActiveModel._name == 'mail.thread' and wizard.model:
post_params['model'] = wizard.model
diff --git a/addons/product_email_template/models/account_invoice.py b/addons/product_email_template/models/account_invoice.py
index 82c0dfbbea0..9668c8cdd58 100644
--- a/addons/product_email_template/models/account_invoice.py
+++ b/addons/product_email_template/models/account_invoice.py
@@ -14,7 +14,7 @@ class AccountInvoice(models.Model):
invoice.message_subscribe([invoice.partner_id.id])
for line in invoice.invoice_line_ids:
if line.product_id.email_template_id:
- invoice.message_post_with_template(line.product_id.email_template_id.id, composition_mode='comment')
+ invoice.message_post_with_template(line.product_id.email_template_id.id, composition_mode='comment', custom_layout='mail.mail_notification_light')
return True
@api.multi
diff --git a/addons/project/data/project_demo.xml b/addons/project/data/project_demo.xml
index 269fee0efb8..c21509b9e9f 100644
--- a/addons/project/data/project_demo.xml
+++ b/addons/project/data/project_demo.xml
@@ -21,20 +21,6 @@
Usability
-
-
- Task: Reception Acknowledgment
- Reception of ${object.name}
-
-
- Dear ${object.partner_id.name or 'customer'},
-Thank you for your enquiry.
-If you have any questions, please let us know.
-Best regards, ]]>
-
-
-
1
diff --git a/addons/project/data/project_mail_template_data.xml b/addons/project/data/project_mail_template_data.xml
index e3d8f1f5be5..a7d4dcc15f4 100644
--- a/addons/project/data/project_mail_template_data.xml
+++ b/addons/project/data/project_mail_template_data.xml
@@ -3,7 +3,7 @@
- project module install then send email
+ Project: Spam admin after install
Your Odoo Project application
help@odoo.com
${user.email|safe}
@@ -113,87 +113,92 @@
name="send_mail"
eval="[ref('mail_template_data_module_install_project'), ref('base.module_project')]"/>
+
+
+ Task: Reception Acknowledgment
+
+ Reception of ${object.name}
+
+
+
+ Dear ${object.partner_id.name or 'customer'},
+ Thank you for your enquiry.
+ If you have any questions, please let us know.
+
+ Thank you,
+
+
+
+
+
+
+
Task: Rating Request
- ${object.rating_get_rated_partner_id().email or '' | safe}
- ${object.project_id.company_id.name}: Service Rating Request
+ ${object.project_id.company_id.name}: Satisfaction Survey
+ ${('"%s" <%s>' % (object.rating_get_rated_partner_id().name, object.rating_get_rated_partner_id().email) if object.rating_get_rated_partner_id().email else '') | safe}
${object.rating_get_partner_id().id}
-
-
+
+
% set access_token = object.rating_get_access_token()
-
-
-
-
- |
- Satisfaction Survey
- |
-
-
-
-
- |
- Hello,
- Please take a moment to rate our services related to the task "${object.name}"
- assigned to ${object.rating_get_rated_partner_id().name}.
- We appreciate your feedback. It helps us to improve continuously.
- |
-
-
-
-
-
- Tell us how you feel about our service:
-
- (click on one of these smileys)
- |
-
-
- |
-
- |
-
-
- |
- | ${(object.user_id.signature or '')| safe} |
-
-
-
-
- |
- % if object.project_id.rating_status == 'stage':
- This customer survey has been sent because your task has been moved to the stage ${object.stage_id.name}
- % endif
- % if object.project_id.rating_status == 'periodic':
- This customer survey is sent ${object.project_id.rating_status_period} as long as the task is in the ${object.stage_id.name} stage.
- % endif
- Email automatically sent by Odoo Project for ${object.project_id.company_id.name}
- |
-
+ % set partner = object.rating_get_partner_id()
+
+
+
+ Hello ${partner.name},
+ Please take a moment to rate our services related to the task "${object.name}"
+ % if object.rating_get_rated_partner_id().name:
+ assigned to ${object.rating_get_rated_partner_id().name}.
+ % else:
+ .
+ % endif
+ |
+
+
+
+ Tell us how you feel about our service
+ (click on one of these smileys)
+ |
+ |
+
+ |
+
+ |
+
+ We appreciate your feedback. It helps us to improve continuously.
+ % if object.project_id.rating_status == 'stage':
+ This customer survey has been sent because your task has been moved to the stage ${object.stage_id.name}
+ % endif
+ % if object.project_id.rating_status == 'periodic':
+ This customer survey is sent ${object.project_id.rating_status_period} as long as the task is in the ${object.stage_id.name} stage.
+ % endif
+ |
+
-]]>
+
+
+
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index d0564c78a28..4d486326217 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -833,7 +833,11 @@ class Task(models.Model):
test_task = self[0]
changes, tracking_value_ids = tracking[test_task.id]
if 'stage_id' in changes and test_task.stage_id.mail_template_id:
- res['stage_id'] = (test_task.stage_id.mail_template_id, {'composition_mode': 'mass_mail'})
+ res['stage_id'] = (test_task.stage_id.mail_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
diff --git a/addons/rating/models/rating.py b/addons/rating/models/rating.py
index 7ad76ddda87..9d2f56b82f8 100644
--- a/addons/rating/models/rating.py
+++ b/addons/rating/models/rating.py
@@ -213,12 +213,33 @@ class RatingMixin(models.AbstractModel):
return rating.access_token
@api.multi
- def rating_send_request(self, template, lang=False, force_send=True):
+ def rating_send_request(self, template, lang=False, subtype_id=False, force_send=True, composition_mode='comment', notif_layout=None):
""" This method send rating request by email, using a template given
- in parameter. """
- lang = lang or 'en_US'
+ in parameter.
+
+ :param template: a mail.template record used to compute the message body;
+ :param lang: optional lang; it can also be specified directly on the template
+ itself in the lang field;
+ :param subtype_id: optional subtype to use when creating the message; is
+ a note by default to avoid spamming followers;
+ :param force_send: whether to send the request directly or use the mail
+ queue cron (preferred option);
+ :param composition_mode: comment (message_post) or mass_mail (template.send_mail);
+ :param notif_layout: layout used to encapsulate the content when sending email;
+ """
+ if lang:
+ template = template.with_context(lang=lang)
+ if subtype_id is False:
+ subtype_id = self.env['ir.model.data'].xmlid_to_res_id('mail.mt_note')
+ if force_send:
+ self = self.with_context(mail_notify_force_send=True)
for record in self:
- template.with_context(lang=lang).send_mail(record.id, force_send=force_send)
+ record.message_post_with_template(
+ template.id,
+ composition_mode=composition_mode,
+ notif_layout=notif_layout if notif_layout is not None else 'mail.mail_notification_light',
+ subtype_id=subtype_id
+ )
@api.multi
def rating_apply(self, rate, token=None, feedback=None, subtype=None):
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py
index 1e8b594e462..acf3c99bc60 100644
--- a/addons/test_mail/tests/test_performance.py
+++ b/addons/test_mail/tests/test_performance.py
@@ -4,9 +4,11 @@
from email.utils import formataddr
from odoo.tests.common import TransactionCase, users, warmup
+from odoo.tests import tagged
from odoo.tools import mute_logger
+@tagged('mail_performance')
class TestMailPerformance(TransactionCase):
def setUp(self):
@@ -113,6 +115,7 @@ class TestMailPerformance(TransactionCase):
})
+@tagged('mail_performance')
class TestAdvMailPerformance(TransactionCase):
def setUp(self):
@@ -295,6 +298,7 @@ class TestAdvMailPerformance(TransactionCase):
record.message_subscribe(partner_ids=self.user_test.partner_id.ids, subtype_ids=subtype_ids)
+@tagged('mail_performance')
class TestHeavyMailPerformance(TransactionCase):
def setUp(self):
diff --git a/addons/website_event_track/data/event_track_data.xml b/addons/website_event_track/data/event_track_data.xml
index 88af18033e2..c5c0569a1ab 100644
--- a/addons/website_event_track/data/event_track_data.xml
+++ b/addons/website_event_track/data/event_track_data.xml
@@ -4,27 +4,26 @@
Track: Confirmation
- Confirmation of ${object.name}
+ Confirmation of ${object.name}
-
- Dear
-
- We are pleased to inform you that your proposal ${object.name} has been accepted and confirmed for the event ${object.event_id.name}.
-
- You will find more details here:
-
-
- Sincerely,
+ Dear ${object.partner_name or ''}
+ We are pleased to inform you that your proposal ${object.name} has been accepted and confirmed for the event ${object.event_id.name}.
+
+ You will find more details here:
+
+
+ Thank you,
+
diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py
index 62d1afff823..e6185595a1a 100644
--- a/addons/website_event_track/models/event_track.py
+++ b/addons/website_event_track/models/event_track.py
@@ -139,7 +139,12 @@ class Track(models.Model):
track = self[0]
changes, tracking_value_ids = tracking[track.id]
if 'stage_id' in changes and track.stage_id.mail_template_id:
- res['stage_id'] = (track.stage_id.mail_template_id, {'composition_mode': 'mass_mail'})
+ res['stage_id'] = (track.stage_id.mail_template_id, {
+ 'composition_mode': 'comment',
+ '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
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index 3981f4b62cd..2da0684c015 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -44,13 +44,13 @@ class _Cleaner(clean.Cleaner):
_style_whitelist = [
'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align',
- 'line-height', 'letter-spacing', 'text-transform', 'text-decoration',
+ 'line-height', 'letter-spacing', 'text-transform', 'text-decoration', 'opacity',
'float', 'vertical-align',
'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right',
'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right',
# box model
- 'border', 'border-color', 'border-radius', 'border-style', 'border-width',
- 'height', 'margin', 'padding', 'width', 'max-width', 'min-width',
+ 'border', 'border-color', 'border-radius', 'border-style', 'border-width', 'border-top',
+ 'height', 'width', 'max-width', 'min-width', 'min-height',
# tables
'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout']
| | | | |
|
| | | | |
| |