[FIX] database_cleanup: unused code + wrong modules clean
parent
6be193348a
commit
a3d4ba0bb6
|
@ -50,9 +50,11 @@ class CleanupPurgeLineModule(models.TransientModel):
|
||||||
if not modules:
|
if not modules:
|
||||||
return True
|
return True
|
||||||
self.logger.info("Purging modules %s", ", ".join(module_names))
|
self.logger.info("Purging modules %s", ", ".join(module_names))
|
||||||
modules.filtered(
|
installed = modules.filtered(lambda x: x.state in ("installed", "to upgrade"))
|
||||||
lambda x: x.state not in ("uninstallable", "uninstalled")
|
((modules - installed) + (modules - installed).downstream_dependencies()).write(
|
||||||
).button_immediate_uninstall()
|
{"state": "to remove"}
|
||||||
|
)
|
||||||
|
installed.button_immediate_uninstall()
|
||||||
modules.env.invalidate_all()
|
modules.env.invalidate_all()
|
||||||
modules.unlink()
|
modules.unlink()
|
||||||
return self.write({"purged": True})
|
return self.write({"purged": True})
|
||||||
|
@ -72,13 +74,6 @@ class CleanupPurgeWizardModule(models.TransientModel):
|
||||||
):
|
):
|
||||||
if get_module_path(module.name, display_warning=False):
|
if get_module_path(module.name, display_warning=False):
|
||||||
continue
|
continue
|
||||||
if module.state == "uninstalled":
|
|
||||||
self.env["cleanup.purge.line.module"].create(
|
|
||||||
{
|
|
||||||
"name": module.name,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
res.append((0, 0, {"name": module.name}))
|
res.append((0, 0, {"name": module.name}))
|
||||||
|
|
||||||
if not res:
|
if not res:
|
||||||
|
|
Loading…
Reference in New Issue