From 488e334fc8fd6601e304635fa577c98b9bfd18e6 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 9 Jun 2020 12:08:09 +0000 Subject: [REF] core: combine default_get() with first onchange() When creating a new record, the client calls `default_get()`, completes the returned values with `False`, and calls `onchange()` to apply the onchange to the defaults. Optimize the double round-trip by integrating `default_get()` inside `onchange()` for the first call. The method is called with an empty list of fields, and usually no field values, except for records in a one2many field. In this case, `onchange()` does both steps above. Task 2261084 --- odoo/addons/test_testing_utilities/tests/test_form_impl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'odoo/addons/test_testing_utilities') diff --git a/odoo/addons/test_testing_utilities/tests/test_form_impl.py b/odoo/addons/test_testing_utilities/tests/test_form_impl.py index af49d27cbe5..ab846bda87e 100644 --- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py +++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py @@ -374,13 +374,13 @@ class TestO2M(TransactionCase): with f.subs.edit(index=0) as s: self.assertEqual(s.v, 5) - self.assertEqual(s.value, False) + self.assertEqual(s.value, 2) r = f.save() self.assertEqual( [get(s) for s in r.subs], - [("5", 0, 5)] + [("5", 2, 5)] ) def test_o2m_inner_default(self): -- cgit v1.2.3