diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-03-27 11:21:21 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-05-20 12:51:43 +0000 |
| commit | 7a7b5b5d9d01e193c2330fe4fe076c2bf53fbc49 (patch) | |
| tree | 301ca4a6283c9c8d2f92a741b92f3a28dd4f3b14 /odoo/addons/test_read_group/tests/test_auto_join.py | |
| parent | e950c395b7a2110a19af61220bee3fb8fa5799bc (diff) | |
[FIX] core: searching through o2m with auto_join
Replaces the auto_join scheme which is pretty fast but doesn't quite
work (it's *completely* broken for read_group) by a subquery which is
slower but has the same semantics as the ORM version.
Ideally we'd use `EXISTS (select 1 from ...)` but that has no support
inside the SQL compiler right now, so use `id in (select inverse_field
from ...)`.
Here are some measures of a `read_group` on a simple object with lines
filtered on line values, similar to
read_group([('order_line.product_uom', '=', xxx)],
fields=['total_amount'], groupby=['user_id'])
+-------+-------+-------+--------+
| | ORM | join |subquery|
+-------+-------+-------+--------+
| large | 160 | 10 | 20 |
+-------+-------+-------+--------+
| many | 36000 | 50 | 180 |
+-------+-------+-------+--------+
* values of data fields (filtering, grouping and aggregating) randomly
picked between 10 different values
* "large" is 1000 objects with 1000~15000 lines each
* "many" is 1000000 objects with 1~40 lines each
closes odoo/odoo#48494
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/addons/test_read_group/tests/test_auto_join.py')
| -rw-r--r-- | odoo/addons/test_read_group/tests/test_auto_join.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/odoo/addons/test_read_group/tests/test_auto_join.py b/odoo/addons/test_read_group/tests/test_auto_join.py index 6c5e7a88f77..7347645949c 100644 --- a/odoo/addons/test_read_group/tests/test_auto_join.py +++ b/odoo/addons/test_read_group/tests/test_auto_join.py @@ -38,7 +38,6 @@ class TestAutoJoin(common.TransactionCase): self.assertEqual(len(result1), 1) self.assertEqual(result1[0]['__count'], 2) - # TO FIX: the first record is counted twice! result2 = model.read_group(domain2, [], []) self.assertEqual(len(result2), 1) - self.assertEqual(result2[0]['__count'], 3) + self.assertEqual(result2[0]['__count'], 2) |
