From ee76d45fd8096d63a7b5fdc0c4c9a2f41adf9dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Jul 2025 17:45:56 +0200 Subject: [PATCH] Add test for methods of buttons Closes #14121 --- trytond/trytond/tests/test_tryton.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/trytond/trytond/tests/test_tryton.py b/trytond/trytond/tests/test_tryton.py index 16b877f015..15d8e3a955 100644 --- a/trytond/trytond/tests/test_tryton.py +++ b/trytond/trytond/tests/test_tryton.py @@ -1104,6 +1104,20 @@ class ModuleTestCase(_DBTestCase): 'keys': set(states) - keys, }) + @with_transaction() + def test_button_methods(self): + "Test button methods without records" + for mname, model in Pool().iterobject(): + if not isregisteredby(model, self.module): + continue + if not issubclass(model, ModelView): + continue + for button in model._buttons: + if is_instance_method(model, button): + getattr(model(), button)() + else: + getattr(model, button)([]) + @with_transaction() def test_xml_files(self): "Test validity of the xml files of the module"