|
|
|
@@ -348,7 +348,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
'partner_ids': [(4, customer_id)],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=34, employee=34):
|
|
|
|
|
with self.assertQueryCount(admin=36, employee=36):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
@users('admin', 'employee')
|
|
|
|
@@ -369,7 +369,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
'partner_ids': [(4, customer.id)],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=35, employee=35):
|
|
|
|
|
with self.assertQueryCount(admin=37, employee=37):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
@users('admin', 'employee')
|
|
|
|
@@ -393,7 +393,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
composer_form.attachment_ids.add(attachment)
|
|
|
|
|
composer = composer_form.save()
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=46, employee=46): # tm+com 45/45
|
|
|
|
|
with self.assertQueryCount(admin=49, employee=49): # tm+com 48/48
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
# notifications
|
|
|
|
@@ -437,7 +437,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
'partner_ids': [(4, customer_id)],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=34, employee=34):
|
|
|
|
|
with self.assertQueryCount(admin=36, employee=36):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
@users('admin', 'employee')
|
|
|
|
@@ -455,7 +455,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
'default_template_id': test_template.id,
|
|
|
|
|
}).create({})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=34, employee=34):
|
|
|
|
|
with self.assertQueryCount(admin=36, employee=36):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
# notifications
|
|
|
|
@@ -479,7 +479,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
'default_template_id': test_template.id,
|
|
|
|
|
}).create({})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=42, employee=42):
|
|
|
|
|
with self.assertQueryCount(admin=44, employee=44):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
# notifications
|
|
|
|
@@ -511,7 +511,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
)
|
|
|
|
|
composer = composer_form.save()
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=43, employee=43):
|
|
|
|
|
with self.assertQueryCount(admin=46, employee=46):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
# notifications
|
|
|
|
@@ -541,7 +541,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
)
|
|
|
|
|
composer = composer_form.save()
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=61, employee=61):
|
|
|
|
|
with self.assertQueryCount(admin=64, employee=64):
|
|
|
|
|
composer._action_send_mail()
|
|
|
|
|
|
|
|
|
|
# notifications
|
|
|
|
@@ -568,7 +568,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
# use another user already pre-defined with the email notification type,
|
|
|
|
|
# so the ormcache is preserved.
|
|
|
|
|
record = self.env['mail.test.track'].create({'name': 'Test'})
|
|
|
|
|
with self.assertQueryCount(admin=37, employee=37):
|
|
|
|
|
with self.assertQueryCount(admin=39, employee=39):
|
|
|
|
|
record.write({
|
|
|
|
|
'user_id': self.user_test_email.id,
|
|
|
|
|
})
|
|
|
|
@@ -577,7 +577,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
@warmup
|
|
|
|
|
def test_message_assignation_inbox(self):
|
|
|
|
|
record = self.env['mail.test.track'].create({'name': 'Test'})
|
|
|
|
|
with self.assertQueryCount(admin=18, employee=18):
|
|
|
|
|
with self.assertQueryCount(admin=19, employee=19):
|
|
|
|
|
record.write({
|
|
|
|
|
'user_id': self.user_test_inbox.id,
|
|
|
|
|
})
|
|
|
|
@@ -651,7 +651,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
def test_message_post_one_email_notification(self):
|
|
|
|
|
record = self.env['mail.test.simple'].create({'name': 'Test'})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=30, employee=30):
|
|
|
|
|
with self.assertQueryCount(admin=31, employee=31):
|
|
|
|
|
record.message_post(
|
|
|
|
|
body=Markup('<p>Test Post Performances with an email ping</p>'),
|
|
|
|
|
partner_ids=self.customer.ids,
|
|
|
|
@@ -663,7 +663,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
|
|
|
|
|
def test_message_post_one_inbox_notification(self):
|
|
|
|
|
record = self.env['mail.test.simple'].create({'name': 'Test'})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=17, employee=17):
|
|
|
|
|
with self.assertQueryCount(admin=18, employee=18):
|
|
|
|
|
record.message_post(
|
|
|
|
|
body=Markup('<p>Test Post Performances with an inbox ping</p>'),
|
|
|
|
|
partner_ids=self.user_test.partner_id.ids,
|
|
|
|
@@ -852,7 +852,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
record = self.container.with_user(self.env.user)
|
|
|
|
|
|
|
|
|
|
# about 20 (19?) queries per additional customer group
|
|
|
|
|
with self.assertQueryCount(admin=53, employee=52):
|
|
|
|
|
with self.assertQueryCount(admin=56, employee=55):
|
|
|
|
|
record.message_post(
|
|
|
|
|
body=Markup('<p>Test Post Performances</p>'),
|
|
|
|
|
message_type='comment',
|
|
|
|
@@ -870,7 +870,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
template = self.env.ref('test_mail.mail_test_container_tpl')
|
|
|
|
|
|
|
|
|
|
# about 20 (19 ?) queries per additional customer group
|
|
|
|
|
with self.assertQueryCount(admin=60, employee=59):
|
|
|
|
|
with self.assertQueryCount(admin=63, employee=62):
|
|
|
|
|
record.message_post_with_source(
|
|
|
|
|
template,
|
|
|
|
|
message_type='comment',
|
|
|
|
@@ -894,7 +894,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
'default_template_id': test_template.id,
|
|
|
|
|
}).create({})
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=131, employee=131):
|
|
|
|
|
with self.assertQueryCount(admin=141, employee=141):
|
|
|
|
|
messages_as_sudo = test_records.message_post_with_source(
|
|
|
|
|
'test_mail.mail_template_simple_test',
|
|
|
|
|
render_values={'partner': self.user_test.partner_id},
|
|
|
|
@@ -960,7 +960,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
})
|
|
|
|
|
rec1 = rec.with_context(active_test=False) # to see inactive records
|
|
|
|
|
self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id)
|
|
|
|
|
with self.assertQueryCount(admin=37, employee=37):
|
|
|
|
|
with self.assertQueryCount(admin=39, employee=39):
|
|
|
|
|
rec.write({'user_id': self.user_portal.id})
|
|
|
|
|
self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id)
|
|
|
|
|
# write tracking message
|
|
|
|
@@ -980,7 +980,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
customer_id = self.customer.id
|
|
|
|
|
user_id = self.user_portal.id
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=88, employee=88):
|
|
|
|
|
with self.assertQueryCount(admin=94, employee=94):
|
|
|
|
|
rec = self.env['mail.test.ticket'].create({
|
|
|
|
|
'name': 'Test',
|
|
|
|
|
'container_id': container_id,
|
|
|
|
@@ -1009,7 +1009,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
rec1 = rec.with_context(active_test=False) # to see inactive records
|
|
|
|
|
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
|
|
|
|
|
self.assertEqual(len(rec1.message_ids), 1)
|
|
|
|
|
with self.assertQueryCount(admin=56, employee=56):
|
|
|
|
|
with self.assertQueryCount(admin=59, employee=59):
|
|
|
|
|
rec.write({
|
|
|
|
|
'name': 'Test2',
|
|
|
|
|
'container_id': self.container.id,
|
|
|
|
@@ -1046,7 +1046,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
|
|
|
|
|
rec1 = rec.with_context(active_test=False) # to see inactive records
|
|
|
|
|
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
|
|
|
|
|
|
|
|
|
|
with self.assertQueryCount(admin=62, employee=62):
|
|
|
|
|
with self.assertQueryCount(admin=65, employee=65):
|
|
|
|
|
rec.write({
|
|
|
|
|
'name': 'Test2',
|
|
|
|
|
'container_id': container_id,
|
|
|
|
@@ -1309,7 +1309,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance):
|
|
|
|
|
attachments = self.env['ir.attachment'].with_user(self.env.user).create(self.test_attachments_vals)
|
|
|
|
|
# enable_logging = self.cr._enable_logging() if self.warm else nullcontext()
|
|
|
|
|
# with self.assertQueryCount(employee=63), enable_logging:
|
|
|
|
|
with self.assertQueryCount(employee=60):
|
|
|
|
|
with self.assertQueryCount(employee=62):
|
|
|
|
|
record_container.with_context({}).message_post(
|
|
|
|
|
body=Markup('<p>Test body <img src="cid:cid1"> <img src="cid:cid2"></p>'),
|
|
|
|
|
subject='Test Subject',
|
|
|
|
|