summaryrefslogtreecommitdiff
path: root/addons/test_mail/tests/test_performance.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-05-23 10:09:35 +0000
committerThibault Delavallée <tde@odoo.com>2019-07-12 14:54:11 +0000
commitbdebcab0cea467e070c1936fed16173247abafdd (patch)
treefab225a6f198dd49cd65f22fbbbda8e6c5ee44ab /addons/test_mail/tests/test_performance.py
parent488a5d5af5418ed5c223af5b61aea0b3100508c1 (diff)
[REF] sms: refactor message_post using SMS notifications
Purpose of this commit is to better include SMS notifications when posting a message. SMS is now just another way of notifying people along with Inbox and email. Following recent mail merge improving notification mechanism [1] we have to define a _notify_record_by_sms method on mail.thread. When a message_post is done using message_type being ``sms`` notification type of customers is set to sms. Customers can be computed on model (generally based on partner_id field) or directly set usign partner°ids. Notification model is updated to store this information directly inside the notification itself. An new ``_message_sms`` helper method is introduced in SMS module allowing to send messages using sms type and notification with a reduced parameters number. It is just a shortcut to message_post, easier to use. Either it computes default recipients on the record set, either it is based on given partners and numbers to notify. The following use cases are notably supported * default computation: find customer, notify by sms; * force recipients to notify by sms (partner_ids); * give a set of numbers to notify by sms (sms_nubmers), not necessarily linked to existing partners; * force number / customer relationship independently of mobile number defined on customer (for example when sending an SMS directly from a mobile field on a lead linked to a customer); Tests are updated accordingly. Performance tests are added in order to have some insights on queries generated when sending SMS, like already done for mail.thread alone. Related to task 1922163 Linked to PR #33510 [1] see be2795513644f09f6b443f462bb67cc5a0762e8d: performance and notification code improvements Co-Authored-By: Thibault Delavallee <tde@odoo.com> Co-Authored-By: Pierre Rousseau <pro@odoo.com>
Diffstat (limited to 'addons/test_mail/tests/test_performance.py')
-rw-r--r--addons/test_mail/tests/test_performance.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py
index 666728d53dd..2099e0ccc1b 100644
--- a/addons/test_mail/tests/test_performance.py
+++ b/addons/test_mail/tests/test_performance.py
@@ -506,7 +506,7 @@ class TestHeavyMailPerformance(BaseMailPerformance):
})
self.assertEqual(rec.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
self.assertEqual(len(rec.message_ids), 1)
- with self.assertQueryCount(__system__=99, emp=103): # com runbot: 99 -103 // test_mail only: 99 - 103
+ with self.assertQueryCount(__system__=100, emp=106): # com runbot: 100 -106 // test_mail only: 100 - 106
rec.write({
'name': 'Test2',
'umbrella_id': self.umbrella.id,
@@ -542,7 +542,7 @@ class TestHeavyMailPerformance(BaseMailPerformance):
})
self.assertEqual(rec.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
- with self.assertQueryCount(__system__=104, emp=108): # test_mail only: 104 - 108
+ with self.assertQueryCount(__system__=105, emp=111): # test_mail only: 105 - 111
rec.write({
'name': 'Test2',
'umbrella_id': umbrella_id,