summaryrefslogtreecommitdiff
path: root/addons/mail/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorPratima Gupta <pgu@odoo.com>2018-03-14 11:16:17 +0530
committerThibault Delavallée <tde@odoo.com>2018-06-08 15:20:04 +0200
commit1184f7872d6776d744c7a516d3fcac99467f1c19 (patch)
tree099f94e3528b298c857f197fd760b4180ecd732f /addons/mail/wizard/mail_compose_message.py
parentcaf400fa7c0e0ef60fb79e889931970e6fa35416 (diff)
[IMP] mail: ease the use and specification of notification emails layout
This commit proposes to ease the use and specification of layout used to encapsulate email body when sending notification emails. This is done through two means * message_post_with_template now supports the custom layout parameter that allows to set the layout to use when sending notification emails in the message_post process. We have to rely on the context as it is the current way of using it in the composer. It is likely to change in a near future; * composer now supports through context (as we have no other choice) specific notification values to give to the notification layout rendering; This commit is related to task 51122 (and PR #24052).
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
-rw-r--r--addons/mail/wizard/mail_compose_message.py10
1 files changed, 6 insertions, 4 deletions
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