From 46d12675a7273d2a4e513644016e9a06e9d7ae64 Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Wed, 10 Jul 2019 08:51:39 +0000 Subject: [FIX] tests: allow False as value for required booleans in SSF A required boolean accepts two values, True and False, however the SSF and the web-client assume False to be equal to NULL and treat them interchangeably. In the SSF, we verify that a required field is filled by checking that its value is different from False, however False is a valid value for a boolean, this means that setting a required boolean to False would never work in the SSF. This commit overcomes this issue by simply skipping the check for fields of type boolean. closes odoo/odoo#34729 Signed-off-by: Xavier Morel (xmo) --- odoo/addons/test_testing_utilities/tests/test_form_impl.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'odoo/addons/test_testing_utilities/tests/test_form_impl.py') 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 0191a4da7ad..c0e5093fd3b 100644 --- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py +++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py @@ -53,6 +53,16 @@ class TestBasic(TransactionCase): ('1', 0, 0, 0) ) + def test_required_bool(self): + f = Form(self.env['test_testing_utilities.req_bool']) + f.f_bool = False + r = f.save() + self.assertEqual(r.f_bool, 0) + + f2 = Form(self.env['test_testing_utilities.req_bool']) + r2 = f2.save() + self.assertEqual(r2.f_bool, 0) + def test_readonly(self): """ Checks that fields with readonly modifiers (marked as readonly or -- cgit v1.2.3