diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-02-04 11:33:50 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-02-26 17:56:32 +0000 |
| commit | 5d62e4954f902e08bda38179bf98919dbd3a57e1 (patch) | |
| tree | df054f47814d5407dbee5290edc42beaa372c640 /odoo/addons/test_new_api/tests/test_new_fields.py | |
| parent | 382f17f4624b45798c9ec4cc4ca37e8cb00b08ec (diff) | |
[FIX] core: fix _flush_search() when _order depends on m2o
closes odoo/odoo#46365
X-original-commit: 604b6a22db8eddfb37f9be31d3826394e25bd86c
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Diffstat (limited to 'odoo/addons/test_new_api/tests/test_new_fields.py')
| -rw-r--r-- | odoo/addons/test_new_api/tests/test_new_fields.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/odoo/addons/test_new_api/tests/test_new_fields.py b/odoo/addons/test_new_api/tests/test_new_fields.py index 94b1dd9c04e..0712e088f78 100644 --- a/odoo/addons/test_new_api/tests/test_new_fields.py +++ b/odoo/addons/test_new_api/tests/test_new_fields.py @@ -1714,7 +1714,23 @@ class TestFields(TransactionCaseWithUserDemo): self.assertEqual(record_no_bin_size.binary_computed, expected_value) self.assertEqual(record_bin_size.binary_computed, expected_value) - def test_96_ir_rule_m2m_field(self): + def test_96_order_m2o(self): + belgium, congo = self.env['test_new_api.country'].create([ + {'name': "Duchy of Brabant"}, + {'name': "Congo"}, + ]) + cities = self.env['test_new_api.city'].create([ + {'name': "Brussels", 'country_id': belgium.id}, + {'name': "Kinshasa", 'country_id': congo.id}, + ]) + # cities are sorted by country_id, name + self.assertEqual(cities.sorted().mapped('name'), ["Kinshasa", "Brussels"]) + + # change order of countries, and check sorted() + belgium.name = "Belgium" + self.assertEqual(cities.sorted().mapped('name'), ["Brussels", "Kinshasa"]) + + def test_97_ir_rule_m2m_field(self): """Ensures m2m fields can't be read if the left records can't be read. Also makes sure reading m2m doesn't take more queries than necessary.""" tag = self.env['test_new_api.multi.tag'].create({}) |
