summaryrefslogtreecommitdiff
path: root/odoo/addons/test_testing_utilities/tests/test_form_impl.py
diff options
context:
space:
mode:
authorLaurent Smet <las@openerp.com>2018-04-03 15:46:04 +0200
committerxmo-odoo <xmo@odoo.com>2018-04-03 15:46:04 +0200
commit34c7fe2e77e67243e690acb9dd867436f7ca2625 (patch)
tree2f484a253ba7317501efdb8a6538524185706b00 /odoo/addons/test_testing_utilities/tests/test_form_impl.py
parentf5b1d4945c93cf5ab9a61b3ffdbe70eb5a2fca60 (diff)
[FIX] testing utilities: o2m should not strip readonly fields
In the normal course of saving-action, readonly fields are stripped out when sending data to the server. The SSF would reuse the same code when "saving" O2M lines to the parent record however that is not correct and would lead to misbehaving views as readonly (non-stored) fields used as "transients" (storing data within the extent of a record's edition session) would not behave properly. Fix by overriding the O2M Form's save so that readonly fields are kept and stored in the parent record. Closes #23620
Diffstat (limited to 'odoo/addons/test_testing_utilities/tests/test_form_impl.py')
-rw-r--r--odoo/addons/test_testing_utilities/tests/test_form_impl.py11
1 files changed, 11 insertions, 0 deletions
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 2806a972335..2232e872dc6 100644
--- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py
+++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py
@@ -393,6 +393,17 @@ class TestO2M(TransactionCase):
with self.assertRaises(AssertionError):
f.subs.remove(index=0)
+ def test_o2m_dyn_onchange(self):
+ f = Form(self.env['test_testing_utilities.onchange_parent'], view='test_testing_utilities.m2o_onchange_view')
+
+ with f.line_ids.new() as new_line:
+ new_line.dummy = 42
+ self.assertTrue(new_line.flag)
+
+ with f.line_ids.edit(index=0) as new_line:
+ self.assertTrue(new_line.flag)
+
+
class TestEdition(TransactionCase):
""" These use the context manager form as we don't need the record
post-save (we already have it) and it's easier to see what bits act on