Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions database_cleanup/models/purge_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@ class CleanupPurgeWizardModule(models.TransientModel):
@api.model
def find(self):
res = []
purge_lines = self.env['cleanup.purge.line.module']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding .browse() for clarity (empty recordset)?
👍 I have experienced slow processes when cleaning databases, maybe it was the cause.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used to add the .browse([]), but meanwhile I see this used as idiom for an empty recordset very often, so if you don't insist, I'd like to keep it this way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't, it was a coding-style question!

for module in self.env['ir.module.module'].search([]):
if get_module_path(module.name):
continue
if module.state == 'uninstalled':
self.env['cleanup.purge.line.module'].create({
purge_lines += self.env['cleanup.purge.line.module'].create({
'name': module.name,
}).purge()
})
continue
res.append((0, 0, {'name': module.name}))

purge_lines.purge()

if not res:
raise UserError(_('No modules found to purge'))
return res
Expand Down