summaryrefslogtreecommitdiff
path: root/addons/test_mass_mailing
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-02-25 12:45:11 +0000
committerSébastien Theys <seb@odoo.com>2020-02-25 13:46:10 +0000
commit6bb0963b6adb588925be9789e9b380eb437a13d2 (patch)
treea9a345ffda88f5752fec9e2d8cdce85183c7cc86 /addons/test_mass_mailing
parent93f10cb6291d3855353e36771e06c08d04b4464f (diff)
[IMP] core: optimize read() by avoiding useless query
When the `select` returns nothing more than ids that are already known, there is no need to make it at all. This removes one query from `_read` every time it has to fetch only fields that are stored in a different table (o2m, ...), which happens all the time when reading a stored field first (triggering prefetch) and then reading a o2m. The query that is now removed was used to check access rules, but the trick is to use `check_access_rule` to verify the rules in python instead. Part of task-2061122 closes odoo/odoo#36263 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/test_mass_mailing')
-rw-r--r--addons/test_mass_mailing/tests/test_performance.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/test_mass_mailing/tests/test_performance.py b/addons/test_mass_mailing/tests/test_performance.py
index 7398aa69bfe..d1791ecb1bb 100644
--- a/addons/test_mass_mailing/tests/test_performance.py
+++ b/addons/test_mass_mailing/tests/test_performance.py
@@ -50,7 +50,8 @@ class TestMassMailPerformance(TestMassMailPerformanceBase):
'mailing_domain': [('id', 'in', self.mm_recs.ids)],
})
- with self.assertQueryCount(__system__=2161, marketing=2161):
+ # runbot needs +50 compared to local
+ with self.assertQueryCount(__system__=1912, marketing=1913):
mailing.action_send_mail()
self.assertEqual(mailing.sent, 50)
@@ -89,7 +90,8 @@ class TestMassMailBlPerformance(TestMassMailPerformanceBase):
'mailing_domain': [('id', 'in', self.mm_recs.ids)],
})
- with self.assertQueryCount(__system__=2512, marketing=2512):
+ # runbot needs +62 compared to local
+ with self.assertQueryCount(__system__=2239, marketing=2240):
mailing.action_send_mail()
self.assertEqual(mailing.sent, 50)