summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier-Do <xdo@odoo.com>2019-04-12 13:16:48 +0000
committerThibault Delavallée <tde@odoo.com>2019-05-29 13:34:32 +0000
commit2fcb3c658df3e504b92ff9b5a805d150cfa7effd (patch)
tree211bc53b2593e3f165ea7831187ad96965e66538
parent581a74143e9d215654b1988e2480c6516a3a4887 (diff)
[REF] mail: rename notif_layout to email_layout_xmlid on message model
Purpose is to make field use more obvious by correctly stating in the name it should contain an xml id to a qweb layout used for email notifications. This renaming is propagated through various calls and addons. Related to task 1943901 Linked to PR #32404
-rw-r--r--addons/gamification/models/challenge.py6
-rw-r--r--addons/gamification/models/goal.py2
-rw-r--r--addons/hr_expense/models/hr_expense.py2
-rw-r--r--addons/hr_recruitment/models/hr_recruitment.py2
-rw-r--r--addons/mail/models/mail_activity.py2
-rw-r--r--addons/mail/models/mail_message.py2
-rw-r--r--addons/mail/models/mail_thread.py12
-rw-r--r--addons/mail/wizard/mail_compose_message.py2
-rw-r--r--addons/portal/wizard/portal_share.py4
-rw-r--r--addons/project/models/project.py2
-rw-r--r--addons/rating/models/rating_mixin.py2
-rw-r--r--addons/sale/models/payment.py2
-rw-r--r--addons/sale/models/sale.py2
-rw-r--r--addons/sale_coupon/models/sale_order.py2
-rw-r--r--addons/website_event_track/models/event_track.py2
-rw-r--r--addons/website_slides/models/slide_slide.py2
16 files changed, 23 insertions, 25 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index c95e1f291d7..5e2515e797c 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -567,7 +567,7 @@ class Challenge(models.Model):
body=body_html,
partner_ids=challenge.mapped('user_ids.partner_id.id'),
subtype='mail.mt_comment',
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
if challenge.report_message_group_id:
challenge.report_message_group_id.message_post(
@@ -591,13 +591,13 @@ class Challenge(models.Model):
body=body_html,
partner_ids=[user.partner_id.id],
subtype='mail.mt_comment',
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
if challenge.report_message_group_id:
challenge.report_message_group_id.message_post(
body=body_html,
subtype='mail.mt_comment',
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
return challenge.write({'last_report_date': fields.Date.today()})
diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 81e8616b316..c5a280f13f2 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -226,7 +226,7 @@ class Goal(models.Model):
body=body_html,
partner_ids=[self.user_id.partner_id.id],
subtype='mail.mt_comment',
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
return {'to_update': True}
diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index 7c028f4d47e..5ece94762a4 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -532,7 +532,7 @@ class HrExpense(models.Model):
subject='Re: %s' % msg_dict.get('subject', ''),
body=body,
subtype_id=self.env.ref('mail.mt_note').id,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
else:
self.env['mail.mail'].create({
diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py
index 393125ba8dc..38570a550e0 100644
--- a/addons/hr_recruitment/models/hr_recruitment.py
+++ b/addons/hr_recruitment/models/hr_recruitment.py
@@ -353,7 +353,7 @@ class Applicant(models.Model):
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'
+ 'email_layout_xmlid': 'mail.mail_notification_light'
})
return res
diff --git a/addons/mail/models/mail_activity.py b/addons/mail/models/mail_activity.py
index 6b9ce7aacf2..3dee568ca10 100644
--- a/addons/mail/models/mail_activity.py
+++ b/addons/mail/models/mail_activity.py
@@ -394,7 +394,7 @@ class MailActivity(models.Model):
subject=_('%s: %s assigned to you') % (activity.res_name, activity.summary or activity.activity_type_id.name),
record_name=activity.res_name,
model_description=model_description,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
@api.multi
diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py
index 5db3abe850f..95fc750066b 100644
--- a/addons/mail/models/mail_message.py
+++ b/addons/mail/models/mail_message.py
@@ -124,7 +124,7 @@ class Message(models.Model):
moderator_id = fields.Many2one('res.users', string="Moderated By", index=True)
need_moderation = fields.Boolean('Need moderation', compute='_compute_need_moderation', search='_search_need_moderation')
#keep notification layout informations to be able to generate mail again
- layout = fields.Char('Layout', copy=False) # xml id of layout
+ email_layout_xmlid = fields.Char('Layout', copy=False, oldname='layout') # xml id of layout
add_sign = fields.Boolean(default=True)
@api.multi
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index b17937f1734..7f29e0d13c4 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -1795,7 +1795,7 @@ class MailThread(models.AbstractModel):
record.message_post_with_template(False, **kwargs)
@api.multi
- def message_post_with_template(self, template_id, **kwargs):
+ def message_post_with_template(self, template_id, email_layout_xmlid=None, **kwargs):
""" Helper method to send a mail with a template
:param template_id : the id of the template to render to create the body of the message
:param **kwargs : parameter to create a mail.compose.message woaerd (which inherit from mail.message)
@@ -1807,7 +1807,6 @@ 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(
@@ -1818,7 +1817,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,
+ 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
@@ -1922,8 +1921,6 @@ class MailThread(models.AbstractModel):
def _message_create(self, values):
create_values = dict(values)
- if 'notif_layout' in create_values:
- create_values['layout'] = create_values.pop('notif_layout')
# Avoid warnings about non-existing fields
for x in ('from', 'to', 'cc', 'canned_response_ids'):
create_values.pop(x, None)
@@ -1931,6 +1928,7 @@ class MailThread(models.AbstractModel):
create_values['channel_ids'] = [(4, cid) for cid in create_values.get('channel_ids', [])]
return self.env['mail.message'].create(create_values)
+
# ------------------------------------------------------
# Notification API
# ------------------------------------------------------
@@ -2010,7 +2008,7 @@ class MailThread(models.AbstractModel):
base_template_ctx = self._notify_prepare_template_context(message, msg_vals, model_description=model_description)
- template_xmlid = message.layout if message.layout else 'mail.message_notification_email'
+ template_xmlid = message.email_layout_xmlid if message.email_layout_xmlid else 'mail.message_notification_email'
try:
base_template = self.env.ref(template_xmlid, raise_if_not_found=True).with_context(lang=base_template_ctx['lang'])
except ValueError:
@@ -2605,7 +2603,7 @@ class MailThread(models.AbstractModel):
body=assignation_msg,
partner_ids=partner_ids,
record_name=record.display_name,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
model_description=model_description,
)
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 77a6dbd632d..2db6a3d8324 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -274,7 +274,7 @@ class MailComposer(models.TransientModel):
post_params = dict(
message_type=wizard.message_type,
subtype_id=subtype_id,
- notif_layout=notif_layout,
+ email_layout_xmlid=notif_layout,
add_sign=not bool(wizard.template_id),
mail_auto_delete=wizard.template_id.auto_delete if wizard.template_id else False,
model_description=model_description)
diff --git a/addons/portal/wizard/portal_share.py b/addons/portal/wizard/portal_share.py
index 0da5ce44a7b..a4597edbb62 100644
--- a/addons/portal/wizard/portal_share.py
+++ b/addons/portal/wizard/portal_share.py
@@ -58,7 +58,7 @@ class PortalShare(models.TransientModel):
'share_link': share_link},
subject=_("You are invited to access %s" % active_record.display_name),
subtype_id=note.id,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
partner_ids=[(6, 0, partner.ids)])
# when partner not user send individual mail with signup token
for partner in self.partner_ids - partner_ids:
@@ -70,6 +70,6 @@ class PortalShare(models.TransientModel):
'share_link': share_link},
subject=_("You are invited to access %s" % active_record.display_name),
subtype_id=note.id,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
partner_ids=[(6, 0, partner.ids)])
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index 3fe07c176fd..2da62547014 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -792,7 +792,7 @@ class Task(models.Model):
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'
+ 'email_layout_xmlid': 'mail.mail_notification_light'
})
return res
diff --git a/addons/rating/models/rating_mixin.py b/addons/rating/models/rating_mixin.py
index 75e131301cc..f7f35080a18 100644
--- a/addons/rating/models/rating_mixin.py
+++ b/addons/rating/models/rating_mixin.py
@@ -160,7 +160,7 @@ class RatingMixin(models.AbstractModel):
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',
+ email_layout_xmlid=notif_layout if notif_layout is not None else 'mail.mail_notification_light',
subtype_id=subtype_id
)
diff --git a/addons/sale/models/payment.py b/addons/sale/models/payment.py
index ae73e9ba0e7..8580878a45d 100644
--- a/addons/sale/models/payment.py
+++ b/addons/sale/models/payment.py
@@ -106,7 +106,7 @@ class PaymentTransaction(models.Model):
for trans in self.filtered(lambda t: t.sale_order_ids):
trans = trans.with_context(ctx_company)
for invoice in trans.invoice_ids:
- invoice.message_post_with_template(int(default_template), notif_layout="mail.mail_notification_paynow")
+ invoice.message_post_with_template(int(default_template), email_layout_xmlid="mail.mail_notification_paynow")
return res
@api.multi
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index adc130e8c0c..63d219df0c8 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -667,7 +667,7 @@ class SaleOrder(models.Model):
template_id = self._find_mail_template(force_confirmation_template=True)
if template_id:
for order in self:
- order.with_context(force_send=True).message_post_with_template(template_id, composition_mode='comment', notif_layout="mail.mail_notification_paynow")
+ order.with_context(force_send=True).message_post_with_template(template_id, composition_mode='comment', email_layout_xmlid="mail.mail_notification_paynow")
@api.multi
def action_done(self):
diff --git a/addons/sale_coupon/models/sale_order.py b/addons/sale_coupon/models/sale_order.py
index f19668de7b5..3487317330e 100644
--- a/addons/sale_coupon/models/sale_order.py
+++ b/addons/sale_coupon/models/sale_order.py
@@ -246,7 +246,7 @@ class SaleOrder(models.Model):
self.message_post_with_template(
template.id, composition_mode='comment',
model='sale.coupon', res_id=coupon.id,
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
def _get_applicable_programs(self):
diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py
index 8d325150719..deb31e167c2 100644
--- a/addons/website_event_track/models/event_track.py
+++ b/addons/website_event_track/models/event_track.py
@@ -142,7 +142,7 @@ class Track(models.Model):
'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'
+ 'email_layout_xmlid': 'mail.mail_notification_light'
})
return res
diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py
index ab84f80d71e..2d2404c65c9 100644
--- a/addons/website_slides/models/slide_slide.py
+++ b/addons/website_slides/models/slide_slide.py
@@ -361,7 +361,7 @@ class Slide(models.Model):
subject=subject,
body=html_body,
subtype='website_slides.mt_channel_slide_published',
- notif_layout='mail.mail_notification_light',
+ email_layout_xmlid='mail.mail_notification_light',
)
return True