diff --git a/module_analysis/tests/test_module.py b/module_analysis/tests/test_module.py index 35139b0f7fc..865be3458db 100644 --- a/module_analysis/tests/test_module.py +++ b/module_analysis/tests/test_module.py @@ -11,8 +11,7 @@ class TestModule(TransactionCase): def setUpClass(cls): super().setUpClass() cls.IrModuleModule = cls.env["ir.module.module"] - # Remove lib because it breaks tests in case of installation of modules with - # pip + # Remove lib because it breaks tests in case of installation of modules with pip cls.env["ir.config_parameter"].set_param( "module_analysis.exclude_directories", "demo,test,tests,doc,description" ) @@ -28,10 +27,9 @@ def test_installed_modules(self): or module.xml_code_qty > 0 or module.js_code_qty > 0, _( - "module %s doesn't have code analysed defined, whereas it is" - " installed." - ) - % (module.name), + "module {} doesn't have code analysed defined, " + "whereas it is installed." + ).format(module.name), ) def test_uninstalled_modules(self): @@ -39,6 +37,39 @@ def test_uninstalled_modules(self): for module in uninstalled_modules: self.assertTrue( module.python_code_qty == 0, - _("module %s has python lines defined, whereas it is" " not installed.") - % (module.name), + _( + "module {} has python lines defined, whereas it is not installed." + ).format(module.name), + ) + + def test_module_with_no_code(self): + modules_with_no_code = self.IrModuleModule.search( + [ + ("python_code_qty", "=", 0), + ("xml_code_qty", "=", 0), + ("js_code_qty", "=", 0), + ] + ) + for module in modules_with_no_code: + self.assertTrue( + module.state != "installed", + _("module {} has no code but is marked as installed.").format( + module.name + ), + ) + + def test_module_with_code(self): + modules_with_code = self.IrModuleModule.search( + [ + ("python_code_qty", ">", 0), + ("xml_code_qty", ">", 0), + ("js_code_qty", ">", 0), + ] + ) + for module in modules_with_code: + self.assertTrue( + module.state == "installed", + _("module {} has code but is not marked as installed.").format( + module.name + ), ) diff --git a/module_analysis/views/view_ir_module_author.xml b/module_analysis/views/view_ir_module_author.xml index 1322c9f7c4b..701c26169cb 100644 --- a/module_analysis/views/view_ir_module_author.xml +++ b/module_analysis/views/view_ir_module_author.xml @@ -28,17 +28,17 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). ir.module.author - + - + Modules Authors ir.actions.act_window ir.module.author - tree,form + list,form ir.module.type - + - + Modules Types ir.actions.act_window ir.module.type - tree,form + list,form ir.module.type.rule - + - + Modules Types Rules ir.actions.act_window ir.module.type.rule - tree + list