diff --git a/database_cleanup/models/purge_modules.py b/database_cleanup/models/purge_modules.py index 88919b0f268..931f75d098c 100644 --- a/database_cleanup/models/purge_modules.py +++ b/database_cleanup/models/purge_modules.py @@ -88,8 +88,6 @@ def find(self): continue res.append((0, 0, {"name": module.name})) - purge_lines.purge() - if not res: raise UserError(_("No modules found to purge")) return res diff --git a/database_cleanup/tests/test_database_cleanup.py b/database_cleanup/tests/test_database_cleanup.py index 3a899c383d5..8974c1e91ce 100644 --- a/database_cleanup/tests/test_database_cleanup.py +++ b/database_cleanup/tests/test_database_cleanup.py @@ -141,8 +141,8 @@ def keep_registry(): with keep_registry(), mute_logger("odoo.modules.graph", "odoo.modules.loading"): purge_modules = self.env["cleanup.purge.wizard.module"].create({}) - # this module should be purged already during default_get - self.assertFalse( + # no modules are purged during default_get + self.assertTrue( self.env["ir.module.module"].search( [("name", "=", "database_cleanup_test_uninstalled")] ) @@ -150,12 +150,18 @@ def keep_registry(): with keep_registry(), mute_logger("odoo.modules.graph", "odoo.modules.loading"): purge_modules.purge_all() - # must be removed by the wizard + # installed modules must be removed by the wizard self.assertFalse( self.env["ir.module.module"].search( [("name", "=", "database_cleanup_test")] ) ) + # uninstalled modules must be removed by the wizard + self.assertFalse( + self.env["ir.module.module"].search( + [("name", "=", "database_cleanup_test_uninstalled")] + ) + ) def tearDown(self): with self.registry.cursor() as cr2: