How to Uninstall a Module via Terminal in Odoo

Odoo Module Uninstallation

by Dharmesh Patel

Sometimes, Odoo users need to remove a module for various reasons: maybe it's causing conflicts, is no longer needed, or you're trying to troubleshoot an issue. While you can uninstall a module through the Odoo user interface, knowing how to do it via the terminal gives you more control and flexibility, especially in cases where the UI might be inaccessible or problematic. This article will guide you through uninstalling a module in Odoo using the terminal, providing a more direct method.

To uninstall a module in Odoo from the terminal, follow these steps:

Step 1: Open Terminal and Access Odoo Shell

Navigate to your Odoo project directory:

cd /path/to/​your/odoo/project
i.e
cd /opt/odoo

Run the Odoo shell:

./odoo-bin shell -d your_database_name

Replace your_database_name with the actual name of the Odoo database you want to connect to.

Step 2: Uninstall the Module

In the Odoo shell, you can execute a Python command to uninstall the module by updating the module's state.

# Replace 'module_name' with the actual technical name of the module

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

if module
module.button_immediate_uninstall()
else:
print(
"Module not found!")

Explanation:

env['ir.module.module']: Refers to the module registry in Odoo.

.button_immediate_uninstall(): This method is used to uninstall the module immediately.

If you want to load specific addons and use a particular database user and password for the Odoo shell, you can do so by including the appropriate parameters, such as the -db_user, --db_password, --addons-path.

Step 3: Exit the Shell

After uninstalling the module, you can exit the shell by typing:

exit()

This will uninstall the module from your Odoo instance directly via the terminal.

Need More Tips?


Keep up with our blog for useful tips.

في ERP
Dharmesh Patel 7 سبتمبر, 2024
أرشفة
تسجيل الدخول حتى تترك تعليقاً
Stopping Task Email Notifications for Specific Users in Odoo