Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

9

How to uninstall a module from command line

By
xpareto
on 11/10/13, 5:37 PM 19,656 views

How to uninstall a module from command line

3
Justin
On 11/17/14, 5:45 PM

It should be possible to uninstall modules programmatically, because then you can script it for automation.

Having to manually log in to a system to perform administrative functions is error prone and tedious for repetitive tasks. In 2014, every GUI operation should have an API command that does the same thing.

I'm scripting an upgrade path for my 6.1 version database and this is making my testing more difficult than it needs to be.

I found a way to do it. Set the state column in ir_module_module for the module to 'to remove' similar to this: psql -c "UPDATE ir_module_module SET state = 'to remove' WHERE name = '';" and then perform a commandline update: openerp-server -u The update will trigger the module removal.

Justin
on 11/18/14, 2:09 AM

Gratitude. Solved it for me with Odoo 9, given I inserted this patch as step 2A in openerp/modules/loading.py, and then commented the corresponding two lines of code at the top of STEP 5. Of course, be careful everybody.... # 13.0.3.3.11-t11 jrook STEP 2A: Before step 3, setup list of modules to remove later during step 5. # since 'to remove' modules will be loaded during step 3 and will exit step 3 in 'installed' state. cr.execute("SELECT name, id FROM ir_module_module WHERE state=%s", ('to remove',)) modules_to_remove = dict(cr.fetchall())

Royal Administrator
on 2/16/16, 12:20 AM

Try for better indent this time... # 13.0.3.3.11-t11 jrook STEP 2A: Before step 3, setup list of modules to remove later during step 5. # since 'to remove' modules will be loaded during step 3 and will exit step 3 in 'installed' state. cr.execute("SELECT name, id FROM ir_module_module WHERE state=%s", ('to remove',)) modules_to_remove = dict(cr.fetchall())

Royal Administrator
on 2/16/16, 12:23 AM

Whoever did it, I do not see a reason to flag this post, so please explain or leave it as is.

Ermin Trevisan
on 3/22/16, 11:09 AM
4
NUMERIGRAPHE
On 3/12/15, 2:57 PM

You can uninstall a module using the XML-RPC API.

Here is the script I use for v7 (it probably works in later version too).

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Uninstall a module"""

import xmlrpclib
import argparse
import getpass

parser = argparse.ArgumentParser()
# Connection args
parser.add_argument('-d', '--database', help="Use DB as the database name",
                    action='store', metavar='DB', default=getpass.getuser())
parser.add_argument('-u', '--user', help="Use USER as the database user name",
                    action='store', metavar='USER', default='admin')
parser.add_argument('-w', '--password',
                    help="Use PASSWORD as the database password.",
                    action='store', metavar='PASSWORD', default='admin')
parser.add_argument('-s', '--url',
                    help="Point to the web services hosted at URL",
                    action='store', metavar='URL',
                    default='http://localhost:8069')
# Feature args
parser.add_argument('module', help="Uninstall the module MODULE",
                    action='store', metavar='MODULE')

args = vars(parser.parse_args())

# Log in
ws_common = xmlrpclib.ServerProxy(args['url'] + '/xmlrpc/common')
uid = ws_common.login(args['database'], args['user'], args['password'])
print "Logged in to the common web service."
# Get the object proxy
ws_object = xmlrpclib.ServerProxy(args['url'] + '/xmlrpc/object')
print "Connected to the object web service."

# Find the parent location by name
res_ids = ws_object.execute(
    args['database'], uid, args['password'],
    'ir.module.module', 'search', [('name', '=', args['module'])])
if len(res_ids) != 1:
    raise Exception("Search failed")

# Uninstall the module
print "Uninstalling '%s'" % args['module']
ws_object.execute(
    args['database'], uid, args['password'],
    'ir.module.module', "button_immediate_uninstall", res_ids)

print "All done."

0
Roberto Barreiro
On 4/1/16, 3:44 PM

My bad...

0
Pavel Pavlov
On 3/22/16, 5:59 AM

Hello,

I don't think there is a command line to do that. The only option that is supported as far as i know is the Settings -> Apps -> <the module=""> -> Uninstall. In general uninstall is not smart idea... you need to be extra careful.

Regards, Pavel Pavlov

0
Gavin Yap
On 3/22/16, 12:24 AM

You can now do it using odoorpc library.

I've did an example of installation here

https://github.com/maclarensg/odoo_module_install_script,

You probably can modify it to uninstall. 

0

Acespritech

--Acespritech--
839
| 3 2 6
India
--Acespritech--

Having 8+ years of OpenERP Experience. We are Specialized in OpenERP/CRM Solutions, software development, Web development, E commerce solutions & other open source solutions.


Skype : acespritech

Email : info@acespritech.com

Acespritech
On 11/11/13, 2:09 AM

Hi,

I think there is no way to uninstall module from command line but temporarily you may cut module(the module you want to uninstall) from your addons path. It is not the best way but atleast it will let you know the issue.

0

Gopakumar N G

--Gopakumar N G--
1198
| 5 3 7
Cochin, India
--Gopakumar N G--

Senior Software Engineer at BroadTech IT Solutions Pvt. Ltd.

Gopakumar N G
On 11/11/13, 7:39 AM

There is no way to uninstall a module from terminal. You can check the possible options by running
./openerp-server --help in terminal.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 11/10/13, 5:37 PM
Seen: 19656 times
Last updated: 4/1/16, 3:44 PM