summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/account/models/account_move.py4
-rw-r--r--addons/crm/data/mail_data.xml2
-rw-r--r--addons/mail/models/mail_thread.py12
3 files changed, 12 insertions, 6 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 7bfff747fdd..13ca6ebd4b5 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -1795,10 +1795,10 @@ class AccountMove(models.Model):
return self.env.ref('account.mt_invoice_validated')
return super(AccountMove, self)._track_subtype(init_values)
- def _get_creation_message(self):
+ def _creation_message(self):
# OVERRIDE
if not self.is_invoice(include_receipts=True):
- return super()._get_creation_message()
+ return super()._creation_message()
return {
'out_invoice': _('Invoice Created'),
'out_refund': _('Credit Note Created'),
diff --git a/addons/crm/data/mail_data.xml b/addons/crm/data/mail_data.xml
index 28253e529b5..d6e6015e2a5 100644
--- a/addons/crm/data/mail_data.xml
+++ b/addons/crm/data/mail_data.xml
@@ -15,7 +15,7 @@
<field name="hidden" eval="True"/>
<field name="res_model">crm.lead</field>
<field name="default" eval="False"/>
- <field name="description">Opportunity created</field>
+ <field name="description">Lead/Opportunity created</field>
</record>
<record id="mt_lead_stage" model="mail.message.subtype">
<field name="name">Stage Changed</field>
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 3a9c68db2a9..96a78aa6079 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -284,14 +284,16 @@ class MailThread(models.AbstractModel):
if not self._context.get('mail_create_nolog'):
threads_no_subtype = self.env[self._name]
for thread in threads:
- body = thread._get_creation_message()
subtype = thread._creation_subtype()
if subtype: # if we have a subtype, post message to notify users from _message_auto_subscribe
- thread.sudo().message_post(body=body, subtype_id=subtype.id, author_id=self.env.user.partner_id.id)
+ thread.sudo().message_post(subtype_id=subtype.id, author_id=self.env.user.partner_id.id)
else:
threads_no_subtype += thread
if threads_no_subtype:
- threads_no_subtype._message_log_batch(bodies={t.id: body for t in threads_no_subtype})
+ bodies = dict(
+ (thread.id, thread._creation_message())
+ for thread in threads_no_subtype)
+ threads_no_subtype._message_log_batch(bodies=bodies)
# post track template if a tracked field changed
threads._discard_tracking()
@@ -415,6 +417,10 @@ class MailThread(models.AbstractModel):
return self.env['mail.message.subtype']
def _get_creation_message(self):
+ """ Deprecated, remove in 14+ """
+ return self._creation_message()
+
+ def _creation_message(self):
""" Get the creation message to log into the chatter at the record's creation.
:returns: The message's body to log.
"""