Skip to Content
Menu
This question has been flagged
6 Replies
28005 Views

I installed a custom module which turned out to have error in xml file. I stopped server and fixed the error. But I cannot access any page after server restart.

It seems that the server still has the problematic module. I need to upgrade the module first. But I cannot access upgrade menu.

Is there a way to upgrade or uninstall a module outside the web?

Regards,

Kibong

Avatar
Discard
Best Answer

You can update a module using the command line.

Upgrade would be: odoo.py -d <database> -u <module> -c <config file>

There is no command line option to delete a module

Avatar
Discard

For uninstall module via terminal you can always do: psql - database -c "update ir_module_module set state='uninstalled' where name='module' ;" ... true not realy using orm but that is commandline way to quickly "uninstall" module.. it will not remove any data, just mark the module uninstalled...

Best Answer

This is not supposed to be the "proper" way, but this is what I use if the database I am using for developement has been foobared.  Use psql (or PgAdmin III) to access the database, open the ir_module_module table, then change the value of the state field of the module you want to change.  The values are: 'uninstalled', 'to install', 'installed', 'to upgrade', 'to remove'.

You must be very careful so that it does not make the database more foobared:

  • never make modules that are 'uninstalled' to be 'installed' or 'to upgrade'.  Always make it 'to install' so that it is installed properly during the next refresh.
  • never make 'installed' module to be 'uninstalled'.  Always try to go through 'to remove' state first so that it is uninstalled properly
  • never delete any record.  Do it from the UI once it is up.
Avatar
Discard

What do you mean by next refresh? How do we refresh the db? Restarting server?

Best Answer

You can update modules when web page is not accesible with a psql command.
 

sudo su postgres
psql -d database_name
UPDATE ir_module_module SET state = 'to upgrade' where name = 'module_name';


Avatar
Discard
Author Best Answer

Dear Stephen & Ivan,

Thank you!

Pardon me that I couldn't leave comment right below your answers due to shortage of karma.

Regards,

Kibong

Avatar
Discard
Best Answer

There are some manual ways but have a look at my pull request:

https://github.com/odoo/odoo/pull/12373

(If a patch link can help: https://patch-diff.githubusercontent.com/raw/odoo/odoo/pull/12373.patch)

And my stackoverflow answer:

http://stackoverflow.com/questions/21485630/how-to-uninstall-manually-openerp-module#answer-41760541

The pull request has been there for a long time but they dont have time. ;)

A Video of how it is helpful:

    https://www.youtube.com/watch?v=7jtmDM0wfFQ

Avatar
Discard
Best Answer

Thanks for the above advice


I have tried the command above but I get the error CRITICAL <database> openerp.service.server: Failed to initialize the database. What else can I try?


Below is the error:



odoo@ubuntu:~/addons/website_report$ /opt/odoo/odoo.py -d MMC_Live -u website_report -c /etc/odoo-server.conf

ERROR: couldn't create the logfile directory. Logging to the standard output.

2015-07-14 12:39:49,424 1995 INFO ? openerp: OpenERP version 8.0

2015-07-14 12:39:49,425 1995 INFO ? openerp: addons paths: ['/opt/odoo/.local/share/Odoo/addons/8.0', u'/opt/odoo/addons', '/opt/odoo/openerp/addons']

2015-07-14 12:39:49,425 1995 INFO ? openerp: database hostname: localhost

2015-07-14 12:39:49,425 1995 INFO ? openerp: database port: 5432

2015-07-14 12:39:49,425 1995 INFO ? openerp: database user: odoo

2015-07-14 12:39:49,641 1995 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069

2015-07-14 12:39:49,663 1995 INFO MMC_Live openerp.modules.loading: loading 1 modules...

2015-07-14 12:39:49,902 1995 INFO MMC_Live openerp.modules.loading: 1 modules loaded in 0.24s, 0 queries

2015-07-14 12:39:52,791 1995 CRITICAL MMC_Live openerp.service.server: Failed to initialize database `MMC_Live`.

Traceback (most recent call last):

File "/opt/odoo/openerp/service/server.py", line 909, in preload_registries

registry = RegistryManager.new(dbname, update_module=update_module)

File "/opt/odoo/openerp/modules/registry.py", line 366, in new

openerp.modules.load_modules(registry._db, force_demo, status, update_module)

File "/opt/odoo/openerp/modules/loading.py", line 326, in load_modules

modobj.button_upgrade(cr, SUPERUSER_ID, ids)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/addons/base/module/module.py", line 542, in button_upgrade

self.update_list(cr, uid)

File "/opt/odoo/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/opt/odoo/openerp/addons/base/module/module.py", line 654, in update_list

handler.load_addons()

File "/opt/odoo/openerp/http.py", line 1298, in load_addons

m = __import__('openerp.addons.' + module)

File "/opt/odoo/openerp/modules/module.py", line 80, in load_module

mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)

File "/opt/odoo/.local/share/Odoo/addons/8.0/auto_backup/__init__.py", line 23, in <module>

import backup_scheduler

File "/opt/odoo/.local/share/Odoo/addons/8.0/auto_backup/backup_scheduler.py", line 33, in <module>

raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)')

ImportError: This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)

^C2015-07-14 12:40:01,877 1995 INFO MMC_Live openerp.service.server: Initiating shutdown

2015-07-14 12:40:01,877 1995 INFO MMC_Live openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 19
4113
1
Mar 16
4160
1
Mar 15
4557
1
Mar 15
7428
1
Nov 22
1327