Browse Source

[FIX] purge uninstalled uninstallable modules instead of deleting

pull/489/head
Holger Brunn 8 years ago
parent
commit
3af70c03a3
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 7
      database_cleanup/model/purge_modules.py

7
database_cleanup/model/purge_modules.py

@ -106,13 +106,18 @@ class CleanupPurgeWizardModule(orm.TransientModel):
def find(self, cr, uid, context=None): def find(self, cr, uid, context=None):
module_pool = self.pool['ir.module.module'] module_pool = self.pool['ir.module.module']
purge_line_pool = self.pool['cleanup.purge.line.module']
module_ids = module_pool.search(cr, uid, [], context=context) module_ids = module_pool.search(cr, uid, [], context=context)
res = [] res = []
for module in module_pool.browse(cr, uid, module_ids, context=context): for module in module_pool.browse(cr, uid, module_ids, context=context):
if get_module_path(module.name): if get_module_path(module.name):
continue continue
if module.state == 'uninstalled': if module.state == 'uninstalled':
module_pool.unlink(cr, uid, module.id, context=context)
purge_line_pool.purge(
cr, uid, [
purge_line_pool.create(
cr, uid, {'name': module.name}, context=context),
], context=context)
continue continue
res.append((0, 0, {'name': module.name})) res.append((0, 0, {'name': module.name}))

Loading…
Cancel
Save