[FIX] mail: avoid sending mail when creating record from data
Before this fix the creation of task assigned to admin was leading to the creation of mails. This is a generic fix to avoid to notifiy a user when he is add as a follower when creating data from odoo data files. closes odoo/odoo#27682
This commit is contained in:
@@ -2339,6 +2339,8 @@ class MailThread(models.AbstractModel):
|
||||
"""
|
||||
if not self or self.env.context.get('mail_auto_subscribe_no_notify'):
|
||||
return
|
||||
if not self.env.registry.ready: # Don't send notification during install
|
||||
return
|
||||
|
||||
view = self.env['ir.ui.view'].browse(self.env['ir.model.data'].xmlid_to_res_id(template))
|
||||
|
||||
|
||||
@@ -361,6 +361,7 @@ class TestHeavyMailPerformance(TransactionCase):
|
||||
self.env.ref('mail.mt_comment').id,
|
||||
self.env.ref('test_mail.st_mail_test_child_full').id]
|
||||
)
|
||||
self.patch(self.env.registry, 'ready', True)
|
||||
|
||||
@mute_logger('odoo.tests', 'odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
|
||||
@users('__system__', 'emp')
|
||||
@@ -595,7 +596,7 @@ class TestHeavyMailPerformance(TransactionCase):
|
||||
def test_complex_tracking_template(self):
|
||||
""" Write performance test involving assignation, tracking with template """
|
||||
customer_id = self.customer.id
|
||||
|
||||
self.assertTrue(self.env.registry.ready, "We need to simulate that registery is ready")
|
||||
rec = self.env['mail.test.full'].create({
|
||||
'name': 'Test',
|
||||
'umbrella_id': self.umbrella.id,
|
||||
|
||||
Reference in New Issue
Block a user