diff options
| author | Thibault Delavallée <tde@odoo.com> | 2018-01-11 14:34:00 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2018-02-26 14:14:10 +0100 |
| commit | 2238408d51659c06da1b1a88d2d8a177c8febcb9 (patch) | |
| tree | 3c4b5d1d429e2364a44b752de8a570562cb55dfb /addons/test_mail/tests/test_performance.py | |
| parent | 97ee12e9c7cca4ac9a83b357b00d4d212f652efd (diff) | |
[REM] mail: remove unnecessary context switch in mail send method
Commit 0d3d0e95636cf8ae0d52c650a28f505a89c3dc89 added a key in context when sending emails to know
the target model name. It was used at that time to forge for footer of
notification emails.
Since that time notification emails have evolved a lot. The code based on
that context key has been removed. Context key has been transformed into a
context switch. However it is not used anymore and can be removed. It allows
to clean a bit the code and save a context switch.
This commit is purely technical and does not hold any functional change.
Purpose is to clean code in order to prepare future changes in mail
application.
This commit allows to gain some queries in mail sending process, meaning
removing context switch is interesting. One query is gained when using
the send process. Complex performance test involving several message post
gain 3 queries each.
Diffstat (limited to 'addons/test_mail/tests/test_performance.py')
| -rw-r--r-- | addons/test_mail/tests/test_performance.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index eeef3e2519d..c3649a25c6d 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -230,7 +230,7 @@ class TestHeavyMailPerformance(TransactionCase): }) mail_ids = mail.ids - with self.assertQueryCount(admin=16, emp=24): # com runbot 16 - 24 // test_mail only: 14 - 22 + with self.assertQueryCount(admin=16, emp=24): # com runbot 16 - 24 // test_mail only: 13 - 21 self.env['mail.mail'].browse(mail_ids).send() self.assertEqual(mail.body_html, '<p>Test</p>') @@ -243,7 +243,7 @@ class TestHeavyMailPerformance(TransactionCase): self.umbrella.message_subscribe(self.user_portal.partner_id.ids) record = self.umbrella.sudo(self.env.user) - with self.assertQueryCount(admin=123, emp=156): # com runbot 121 - 154 // test_mail only: 117 - 149 + with self.assertQueryCount(admin=120, emp=153): # com runbot 118 - 151 // test_mail only: 114 - 146 record.message_post( body='<p>Test Post Performances</p>', message_type='comment', @@ -260,7 +260,7 @@ class TestHeavyMailPerformance(TransactionCase): record = self.umbrella.sudo(self.env.user) template_id = self.env.ref('test_mail.mail_test_tpl').id - with self.assertQueryCount(admin=148, emp=196): # com runbot 146 - 194 // test_mail only: 140 - 186 + with self.assertQueryCount(admin=145, emp=193): # com runbot 143 - 191 // test_mail only: 137 - 183 record.message_post_with_template(template_id, message_type='comment', composition_mode='comment') self.assertEqual(record.message_ids[0].body, '<p>Adding stuff on %s</p>' % record.name) @@ -276,7 +276,7 @@ class TestHeavyMailPerformance(TransactionCase): customer_id = self.customer.id user_id = self.user_portal.id - with self.assertQueryCount(admin=335, emp=397): # test_mail only: 322 - 382 + with self.assertQueryCount(admin=332, emp=394): # test_mail only: 319 - 379 rec = self.env['mail.test.full'].create({ 'name': 'Test', 'umbrella_id': umbrella_id, @@ -315,7 +315,7 @@ class TestHeavyMailPerformance(TransactionCase): }) self.assertEqual(rec.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id) - with self.assertQueryCount(admin=238, emp=278): # test_mail only: 231 - 270 + with self.assertQueryCount(admin=235, emp=275): # test_mail only: 228 - 267 rec.write({ 'name': 'Test2', 'umbrella_id': umbrella_id, |
