Skip to content

Instantly share code, notes, and snippets.

@PierreCourt
Last active May 25, 2023 08:21
Show Gist options
  • Select an option

  • Save PierreCourt/ae84f243642e55044712edd31f645ef1 to your computer and use it in GitHub Desktop.

Select an option

Save PierreCourt/ae84f243642e55044712edd31f645ef1 to your computer and use it in GitHub Desktop.
Find ir.model with no app linked
l = []
for m in env['ir.model'].search([]):
m._in_modules()
if m.modules is '':
l.append(m.id)
#query = ("delete from ir_model_fields where model_id in (%s)" % ','.join(map(str, l)))
#env.cr.execute(query)
#env.cr.commit()
#query = ("delete from ir_model where id in (%s)" % ','.join(map(str, l)))
#env.cr.execute(query)
#env.cr.commit()
raise UserError(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment