Browse Source

[IMP] purge uninstalled unavailable modules in bulk

12.0-mig-module_prototyper_last
Holger Brunn 6 years ago
parent
commit
0bc6322dc8
  1. 7
      database_cleanup/models/purge_modules.py

7
database_cleanup/models/purge_modules.py

@ -72,6 +72,7 @@ class CleanupPurgeWizardModule(models.TransientModel):
@api.model @api.model
def find(self): def find(self):
res = [] res = []
purge_lines = self.env['cleanup.purge.line.module']
IrModule = self.env['ir.module.module'] IrModule = self.env['ir.module.module']
for module in IrModule.search( for module in IrModule.search(
[ [
@ -82,12 +83,14 @@ 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': if module.state == 'uninstalled':
self.env['cleanup.purge.line.module'].create({
purge_lines += self.env['cleanup.purge.line.module'].create({
'name': module.name, 'name': module.name,
}).purge()
})
continue continue
res.append((0, 0, {'name': module.name})) res.append((0, 0, {'name': module.name}))
purge_lines.purge()
if not res: if not res:
raise UserError(_('No modules found to purge')) raise UserError(_('No modules found to purge'))
return res return res

Loading…
Cancel
Save