Menu

Помощь

0

AttributeError: 'NoneType' object has no attribute '_table' error when trying to uninstall a module

Avatar
sneha antony

I met with the following error when I tried to uninstall a module from openerp interface

Client Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1129, in call_button action = self._call_kw(req, model, method, args, {}) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1117, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/opt/openerp/server/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/opt/openerp/server/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/opt/openerp/server/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/opt/openerp/server/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/opt/openerp/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/opt/openerp/server/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/opt/openerp/server/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/opt/openerp/server/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/opt/openerp/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/opt/openerp/server/openerp/addons/base/module/module.py", line 495, in button_immediate_uninstall return self._button_immediate_function(cr, uid, ids, self.button_uninstall, context=context) File "/opt/openerp/server/openerp/addons/base/module/module.py", line 475, in _button_immediate_function _, pool = pooler.restart_pool(cr.dbname, update_module=True) File "/opt/openerp/server/openerp/pooler.py", line 39, in restart_pool registry = RegistryManager.new(db_name, force_demo, status, update_module) File "/opt/openerp/server/openerp/modules/registry.py", line 219, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/opt/openerp/server/openerp/modules/loading.py", line 421, in load_modules pool.get('ir.module.module').module_uninstall(cr, SUPERUSER_ID, mod_ids_to_remove) File "/opt/openerp/server/openerp/addons/base/module/module.py", line 439, in module_uninstall ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context) File "/opt/openerp/server/openerp/addons/base/ir/ir_model.py", line 536, in _module_data_uninstall WHERE cs.contype=%s and cs.conname=%s and cl.relname=%s""", ('f', name, model_obj._table)) AttributeError: 'NoneType' object has no attribute '_table'.

But the module which I am trying to remove is not in the /OPT/OPENERP/SERVER/OPENERP/ADDONS directory.It has been already removed.Can anyone please help in sorting out this issue?

Аватар
Отменить
3 Ответы
0
Avatar
Zicklee
Best Answer

This normally happens when you have a one2many or other types of links to relations in a module that you want to uninstall. Fist check that the module that you want to uninstall has any relation with other modules?. Remove the dependencies so that each module can be independently installed and uninstalled.

Аватар
Отменить
0
Avatar
Daryl van Sittert
Best Answer

I completely messed up my custom module and had to uninstall it manually.

I had to get the ID of each model that I created in my custom module:

"select * from ir_model where model like '%my_model_name%';"

And then delete the contrainsts, relations and models from the DB by replacing <ID> with your particular ID from above.

"delete from ir_model_constraint where model = <ID>;
delete from ir_model_relation where model = <ID>;
delete from ir_model where id = <ID>;"

After this, the uninstall worked.  I wouldn't do this on a live system.  I have no idea about the long term consequences but it seems to be working fine on my dev platform.

Аватар
Отменить