How to check if a module is installed or a model is existed in odoo

Viewed 3484

I want to inherit a form from another custom module without depends but It need to be check if that module is installed or model is existed before inherit it. I researched many docs but not found any solution regards so pls help me how can I do this

3 Answers

You can know if a module is installed checking the state field in the ir_module_module table.

I hope this help you!

Check whether the module has been installed, and is in an installed state by querying against ir.module.module:

bokeh = self.env['ir.module.module'].search([('name', '=', 'module_name')])

if not bokeh or bokeh.state != 'installed': 
    raise UserError(_('...'))

To check module installed in odoo or not follow below step :

Login with Administrator access user > Click on Apps Menu from the Top Bar > You can search module with name or Apply Filter Installed

enter image description here

Related