@@ -132,10 +74,20 @@
- Your
-
-
-
+ Your
+
+
+
+
+
+
+
+
+
+
+
+
+
|
|
@@ -263,83 +215,5 @@
-
-
-
-
- Dear ,
- You have been assigned to the .
-
-
-
- View
-
-
-
-
-
-
-
- done
- (originally assigned to )
- :
-
-
-
-
-
-
-
-
- Original note:
-
-
-
-
-
-
-
- assigned you an activity
- ()
- on
- to close for .
-
-
- View
-
-
-
-
-
-
-
-
- This has been modified from:
- This has been created from:
-
- ,
-
-
-
-
-
-
-
- Hello ,
- The email sent to cannot be processed. This address
- is used to collect replies and should not be used to directly contact .
- Please contact us instead using
- Regards,
- The team.
-
-
-
-
-
-
-
-
-
diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py
index aab8d014c72..710dbcb8e04 100644
--- a/addons/mail/models/mail_template.py
+++ b/addons/mail/models/mail_template.py
@@ -236,7 +236,8 @@ class MailTemplate(models.Model):
records.check_access_rights('read')
records.check_access_rule('read')
- def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None, notif_layout=False):
+ def send_mail(self, res_id, force_send=False, raise_exception=False, email_values=None,
+ email_layout_xmlid=False):
""" Generates a new mail.mail. Template is rendered on record given by
res_id and model coming from template.
@@ -245,7 +246,7 @@ class MailTemplate(models.Model):
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
+ :param str email_layout_xmlid: optional notification layout to encapsulate the
generated email;
:returns: id of the mail.mail that was created """
@@ -266,11 +267,15 @@ class MailTemplate(models.Model):
if 'email_from' in values and not values.get('email_from'):
values.pop('email_from')
# encapsulate body
- if notif_layout and values['body_html']:
+ if email_layout_xmlid and values['body_html']:
try:
- template = self.env.ref(notif_layout, raise_if_not_found=True)
+ template = self.env.ref(email_layout_xmlid, 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))
+ _logger.warning(
+ 'QWeb template %s not found when sending template %s. Sending without layout.',
+ email_layout_xmlid,
+ self.name
+ )
else:
record = self.env[self.model].browse(res_id)
model = self.env['ir.model']._get(record._name)
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index a836a9939b9..b33bf64f537 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -1890,10 +1890,10 @@ class MailThread(models.AbstractModel):
active_ids=res_ids,
active_model=kwargs.get('model', self._name),
default_composition_mode=kwargs['composition_mode'],
+ default_email_layout_xmlid=email_layout_xmlid,
default_model=kwargs.get('model', self._name),
default_res_id=res_id,
default_template_id=template_id,
- custom_layout=email_layout_xmlid,
).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/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 3d91e4cde93..57857763420 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -49,6 +49,11 @@ class MailComposer(models.TransientModel):
- active_ids: record IDs
- default_model or active_model
"""
+ # backward compatibility of context before addition of
+ # email_layout_xmlid field: to remove in 15.1+
+ if self._context.get('custom_layout') and 'default_email_layout_xmlid' not in self._context:
+ self = self.with_context(default_email_layout_xmlid=self._context['custom_layout'])
+
result = super(MailComposer, self).default_get(fields)
# author
@@ -94,6 +99,7 @@ class MailComposer(models.TransientModel):
attachment_ids = fields.Many2many(
'ir.attachment', 'mail_compose_message_ir_attachments_rel',
'wizard_id', 'attachment_id', 'Attachments')
+ email_layout_xmlid = fields.Char('Email Notification Layout', copy=False)
layout = fields.Char('Layout', copy=False) # xml id of layout
add_sign = fields.Boolean(default=True)
# origin
@@ -241,7 +247,6 @@ class MailComposer(models.TransientModel):
def _action_send_mail(self, auto_commit=False):
""" 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')
# Several custom layouts make use of the model description at rendering, e.g. in the
# 'View ' button. Some models are used for different business concepts, such as
# 'purchase.order' which is used for a RFQ and and PO. To avoid confusion, we must use a
@@ -249,6 +254,7 @@ class MailComposer(models.TransientModel):
# Therefore, we can set the description in the context from the beginning to avoid falling
# back on the regular display_name retrieved in '_notify_prepare_template_context'.
model_description = self._context.get('model_description')
+
for wizard in self:
# Duplicate attachments linked to the email.template.
# Indeed, basic mail.compose.message wizard duplicates attachments in mass
@@ -304,7 +310,7 @@ class MailComposer(models.TransientModel):
post_params = dict(
message_type=wizard.message_type,
subtype_id=subtype_id,
- email_layout_xmlid=notif_layout,
+ email_layout_xmlid=wizard.email_layout_xmlid,
add_sign=not bool(wizard.template_id),
mail_auto_delete=wizard.template_id.auto_delete if wizard.template_id else self._context.get('mail_auto_delete', True),
model_description=model_description)
diff --git a/addons/mail/wizard/mail_compose_message_views.xml b/addons/mail/wizard/mail_compose_message_views.xml
index 1771f53bf47..e8b5bfb9c97 100644
--- a/addons/mail/wizard/mail_compose_message_views.xml
+++ b/addons/mail/wizard/mail_compose_message_views.xml
@@ -10,6 +10,7 @@
+
diff --git a/addons/mail_group/models/mail_group.py b/addons/mail_group/models/mail_group.py
index bf8ae17d853..8794ef8029a 100644
--- a/addons/mail_group/models/mail_group.py
+++ b/addons/mail_group/models/mail_group.py
@@ -589,7 +589,7 @@ class MailGroup(models.Model):
template = self.env.ref('mail_group.mail_template_list_subscribe')
template.with_context(token_url=confirm_action_url).send_mail(
self.id,
- force_send=True,
+ email_layout_xmlid='mail.mail_notification_light',
email_values={
'author_id': self.create_uid.partner_id.id,
'auto_delete': True,
@@ -597,7 +597,7 @@ class MailGroup(models.Model):
'email_to': email,
'message_type': 'user_notification',
},
- notif_layout='mail.mail_notification_light',
+ force_send=True,
)
_logger.info('Subscription email sent to %s.', email)
@@ -609,7 +609,7 @@ class MailGroup(models.Model):
template = self.env.ref('mail_group.mail_template_list_unsubscribe')
template.with_context(token_url=confirm_action_url).send_mail(
self.id,
- force_send=True,
+ email_layout_xmlid='mail.mail_notification_light',
email_values={
'author_id': self.create_uid.partner_id.id,
'auto_delete': True,
@@ -617,7 +617,7 @@ class MailGroup(models.Model):
'email_to': email,
'message_type': 'user_notification',
},
- notif_layout='mail.mail_notification_light',
+ force_send=True,
)
_logger.info('Unsubscription email sent to %s.', email)
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py
index 3cb86fbc292..bf556b7de34 100644
--- a/addons/purchase/models/purchase.py
+++ b/addons/purchase/models/purchase.py
@@ -372,7 +372,7 @@ class PurchaseOrder(models.Model):
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
- 'custom_layout': "mail.mail_notification_paynow",
+ 'default_email_layout_xmlid': "mail.mail_notification_paynow",
'force_email': True,
'mark_rfq_as_sent': True,
})
@@ -716,8 +716,9 @@ class PurchaseOrder(models.Model):
self.id,
force_send=True,
raise_exception=False,
+ email_layout_xmlid="mail.mail_notification_paynow",
email_values={'email_to': self.env.user.email, 'recipient_ids': []},
- notif_layout="mail.mail_notification_paynow")
+ )
return {'toast_message': escape(_("A sample email has been sent to %s.", self.env.user.email))}
def _send_reminder_open_composer(self,template_id):
@@ -735,7 +736,7 @@ class PurchaseOrder(models.Model):
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
- 'custom_layout': "mail.mail_notification_paynow",
+ 'default_email_layout_xmlid': "mail.mail_notification_paynow",
'force_email': True,
'mark_rfq_as_sent': True,
})
diff --git a/addons/rating/models/rating_mixin.py b/addons/rating/models/rating_mixin.py
index 4b3c0289a4a..cb21602443b 100644
--- a/addons/rating/models/rating_mixin.py
+++ b/addons/rating/models/rating_mixin.py
@@ -166,19 +166,20 @@ class RatingMixin(models.AbstractModel):
rating = ratings[0]
return rating.access_token
- def rating_send_request(self, template, lang=False, subtype_id=False, force_send=True, composition_mode='comment', notif_layout=None):
+ def rating_send_request(self, template, lang=False, subtype_id=False, force_send=True, composition_mode='comment',
+ email_layout_xmlid=None):
""" This method send rating request by email, using a template given
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
+ :param record template: a mail.template record used to compute the message body;
+ :param str 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
+ :param int 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
+ :param bool 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;
+ :param str composition_mode: comment (message_post) or mass_mail (template.send_mail);
+ :param str email_layout_xmlid: layout used to encapsulate the content when sending email;
"""
if lang:
template = template.with_context(lang=lang)
@@ -190,7 +191,7 @@ class RatingMixin(models.AbstractModel):
record.message_post_with_template(
template.id,
composition_mode=composition_mode,
- email_layout_xmlid=notif_layout if notif_layout is not None else 'mail.mail_notification_light',
+ email_layout_xmlid=email_layout_xmlid if email_layout_xmlid is not None else 'mail.mail_notification_light',
subtype_id=subtype_id
)
diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py
index 8b9e2fbfbc2..2b67d2db2c9 100644
--- a/addons/repair/models/repair.py
+++ b/addons/repair/models/repair.py
@@ -292,7 +292,7 @@ class Repair(models.Model):
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
- 'custom_layout': 'mail.mail_notification_light',
+ 'default_email_layout_xmlid': 'mail.mail_notification_light',
}
return {
'type': 'ir.actions.act_window',
diff --git a/addons/sale/models/res_company.py b/addons/sale/models/res_company.py
index 2bc71c254ab..5950c925314 100644
--- a/addons/sale/models/res_company.py
+++ b/addons/sale/models/res_company.py
@@ -81,7 +81,7 @@ class ResCompany(models.Model):
message_composer = self.env['mail.compose.message'].with_context(
default_use_template=bool(template),
mark_so_as_sent=True,
- custom_layout='mail.mail_notification_paynow',
+ default_email_layout_xmlid='mail.mail_notification_paynow',
proforma=self.env.context.get('proforma', False),
force_email=True, mail_notify_author=True
).create({
diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py
index eb489b0034b..115947ace5a 100644
--- a/addons/sale/models/sale_order.py
+++ b/addons/sale/models/sale_order.py
@@ -900,7 +900,7 @@ class SaleOrder(models.Model):
'default_template_id': template_id,
'default_composition_mode': 'comment',
'mark_so_as_sent': True,
- 'custom_layout': "mail.mail_notification_paynow",
+ 'default_email_layout_xmlid': "mail.mail_notification_paynow",
'proforma': self.env.context.get('proforma', False),
'force_email': True,
'model_description': self.with_context(lang=lang).type_name,
diff --git a/addons/sale_gift_card/models/sale_order.py b/addons/sale_gift_card/models/sale_order.py
index aa422fecec9..ca20389a610 100644
--- a/addons/sale_gift_card/models/sale_order.py
+++ b/addons/sale_gift_card/models/sale_order.py
@@ -54,7 +54,7 @@ class SaleOrder(models.Model):
template = self.env.ref('sale_gift_card.mail_template_gift_card', raise_if_not_found=False)
if template and self.gift_card_count:
for gift in self.order_line.mapped("generated_gift_card_ids"):
- template.send_mail(gift.id, force_send=True, notif_layout='mail.mail_notification_light')
+ template.send_mail(gift.id, force_send=True, email_layout_xmlid='mail.mail_notification_light')
def _recompute_gift_card_lines(self):
for record in self:
diff --git a/addons/survey/models/survey_survey.py b/addons/survey/models/survey_survey.py
index fc3cc4615de..0ca9147026c 100644
--- a/addons/survey/models/survey_survey.py
+++ b/addons/survey/models/survey_survey.py
@@ -846,7 +846,7 @@ class Survey(models.Model):
default_survey_id=self.id,
default_use_template=bool(template),
default_template_id=template and template.id or False,
- notif_layout='mail.mail_notification_light',
+ default_email_layout_xmlid='mail.mail_notification_light',
)
return {
'type': 'ir.actions.act_window',
diff --git a/addons/survey/models/survey_user_input.py b/addons/survey/models/survey_user_input.py
index 93e86ccb7c6..5c1ae626a1f 100644
--- a/addons/survey/models/survey_user_input.py
+++ b/addons/survey/models/survey_user_input.py
@@ -216,7 +216,7 @@ class SurveyUserInput(models.Model):
for user_input in self:
if user_input.survey_id.certification and user_input.scoring_success:
if user_input.survey_id.certification_mail_template_id and not user_input.test_entry:
- user_input.survey_id.certification_mail_template_id.send_mail(user_input.id, notif_layout="mail.mail_notification_light")
+ user_input.survey_id.certification_mail_template_id.send_mail(user_input.id, email_layout_xmlid="mail.mail_notification_light")
if user_input.survey_id.certification_give_badge:
badge_ids.append(user_input.survey_id.certification_badge_id.id)
diff --git a/addons/survey/wizard/survey_invite.py b/addons/survey/wizard/survey_invite.py
index a65708cb155..ba48cb79c04 100644
--- a/addons/survey/wizard/survey_invite.py
+++ b/addons/survey/wizard/survey_invite.py
@@ -212,13 +212,13 @@ class SurveyInvite(models.TransientModel):
else:
mail_values['email_to'] = answer.email
- # optional support of notif_layout in context
- notif_layout = self.env.context.get('notif_layout', self.env.context.get('custom_layout'))
- if notif_layout:
+ # optional support of default_email_layout_xmlid in context
+ email_layout_xmlid = self.env.context.get('default_email_layout_xmlid', self.env.context.get('notif_layout'))
+ if email_layout_xmlid:
try:
- template = self.env.ref(notif_layout, raise_if_not_found=True)
+ template = self.env.ref(email_layout_xmlid, raise_if_not_found=True)
except ValueError:
- _logger.warning('QWeb template %s not found when sending survey mails. Sending without layouting.' % (notif_layout))
+ _logger.warning('QWeb template %s not found when sending survey mails. Sending without layout', email_layout_xmlid)
else:
template_ctx = {
'message': self.env['mail.message'].sudo().new(dict(body=mail_values['body_html'], record_name=self.survey_id.title)),
diff --git a/addons/test_mail/tests/test_mail_template.py b/addons/test_mail/tests/test_mail_template.py
index 33673110be5..006e9a6706c 100644
--- a/addons/test_mail/tests/test_mail_template.py
+++ b/addons/test_mail/tests/test_mail_template.py
@@ -137,7 +137,7 @@ class TestMailTemplate(TestMailCommon, TestRecipients):
})
test_template = self.env['mail.template'].browse(self.test_template.ids)
- mail_id = test_template.send_mail(test_record.id, notif_layout='test_mail.test_layout')
+ mail_id = test_template.send_mail(test_record.id, email_layout_xmlid='test_mail.test_layout')
mail = self.env['mail.mail'].sudo().browse(mail_id)
self.assertEqual(mail.body_html,
'Spanish Body for %s Spanish Layout Spanish description' % self.test_record.name)
@@ -156,7 +156,7 @@ class TestMailTemplate(TestMailCommon, TestRecipients):
})
test_template = self.env['mail.template'].browse(self.test_template.ids)
- mail_id = test_template.send_mail(test_record.id, notif_layout='test_mail.test_layout')
+ mail_id = test_template.send_mail(test_record.id, email_layout_xmlid='test_mail.test_layout')
mail = self.env['mail.mail'].sudo().browse(mail_id)
self.assertEqual(mail.body_html,
'Spanish Body for %s Spanish Layout Spanish description' % self.test_record.name)
diff --git a/addons/test_mail/tests/test_message_post.py b/addons/test_mail/tests/test_message_post.py
index b616b60831d..f7c63a0e117 100644
--- a/addons/test_mail/tests/test_message_post.py
+++ b/addons/test_mail/tests/test_message_post.py
@@ -51,7 +51,6 @@ class TestMessagePost(TestMailCommon, TestRecipients):
recipients_data = self._generate_notify_recipients(self.partner_1 + self.partner_2 + self.partner_employee)
for email_xmlid in ['mail.message_notification_email',
- 'mail.mail_notification_borders',
'mail.mail_notification_light',
'mail.mail_notification_paynow']:
test_message.write({'email_layout_xmlid': email_xmlid})
diff --git a/addons/website_payment/models/payment_transaction.py b/addons/website_payment/models/payment_transaction.py
index b4f4144153c..7a4bc9ad11d 100644
--- a/addons/website_payment/models/payment_transaction.py
+++ b/addons/website_payment/models/payment_transaction.py
@@ -33,8 +33,8 @@ class PaymentTransaction(models.Model):
'comment': comment,
}, engine='ir.qweb', minimal_qcontext=True)
self.env.ref('website_payment.mail_template_donation').send_mail(
- self.id, notif_layout="mail.mail_notification_light",
- force_send=True,
+ self.id,
+ email_layout_xmlid="mail.mail_notification_light",
email_values={
'email_to': recipient_email if is_internal_notification else self.partner_email,
'email_from': self.company_id.email_formatted,
@@ -42,4 +42,5 @@ class PaymentTransaction(models.Model):
'subject': subject,
'body_html': body,
},
+ force_send=True,
)
diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py
index b132de36e09..f1da46902d8 100644
--- a/addons/website_slides/models/slide_channel.py
+++ b/addons/website_slides/models/slide_channel.py
@@ -559,7 +559,7 @@ class Channel(models.Model):
default_channel_id=self.id,
default_use_template=bool(template),
default_template_id=template and template.id or False,
- notif_layout='website_slides.mail_notification_channel_invite',
+ default_email_layout_xmlid='website_slides.mail_notification_channel_invite',
)
return {
'type': 'ir.actions.act_window',
diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py
index e21c1b7bdb7..849582928b1 100644
--- a/addons/website_slides/models/slide_slide.py
+++ b/addons/website_slides/models/slide_slide.py
@@ -548,7 +548,7 @@ class Slide(models.Model):
template = template.sudo()
email_values['email_from'] = self.env.company.catchall_formatted or self.env.company.email_formatted
- mail_ids.append(template.send_mail(record.id, notif_layout='mail.mail_notification_light', email_values=email_values))
+ mail_ids.append(template.send_mail(record.id, email_layout_xmlid='mail.mail_notification_light', email_values=email_values))
return mail_ids
def action_like(self):
diff --git a/addons/website_slides/wizard/slide_channel_invite.py b/addons/website_slides/wizard/slide_channel_invite.py
index 79698286ade..6c66d0c5842 100644
--- a/addons/website_slides/wizard/slide_channel_invite.py
+++ b/addons/website_slides/wizard/slide_channel_invite.py
@@ -91,13 +91,13 @@ class SlideChannelInvite(models.TransientModel):
'recipient_ids': [(4, slide_channel_partner.partner_id.id)]
}
- # optional support of notif_layout in context
- notif_layout = self.env.context.get('notif_layout', self.env.context.get('custom_layout'))
- if notif_layout:
+ # optional support of default_email_layout_xmlid in context
+ email_layout_xmlid = self.env.context.get('default_email_layout_xmlid', self.env.context.get('notif_layout'))
+ if email_layout_xmlid:
try:
- template = self.env.ref(notif_layout, raise_if_not_found=True)
+ template = self.env.ref(email_layout_xmlid, raise_if_not_found=True)
except ValueError:
- _logger.warning('QWeb template %s not found when sending slide channel mails. Sending without layouting.' % (notif_layout))
+ _logger.warning('QWeb template %s not found when sending slide channel mails. Sending without layout.', email_layout_xmlid)
else:
# could be great to use _notify_prepare_template_context someday
template_ctx = {
diff --git a/addons/website_slides_survey/models/survey_user.py b/addons/website_slides_survey/models/survey_user.py
index f19aaa4d610..120a6049cc9 100644
--- a/addons/website_slides_survey/models/survey_user.py
+++ b/addons/website_slides_survey/models/survey_user.py
@@ -50,7 +50,7 @@ class SurveyUserInput(models.Model):
continue
self.env.ref('website_slides_survey.mail_template_user_input_certification_failed').send_mail(
- user_input.id, notif_layout="mail.mail_notification_light"
+ user_input.id, email_layout_xmlid="mail.mail_notification_light"
)
removed_memberships = removed_memberships_per_partner.get(
| |