From 9c741294196dadfd88be07d3ee85e4cb801b2e4f Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Mon, 26 Jan 2009 22:27:51 +0200 Subject: [PATCH] Module unload: workaround missing models. If module unload asks to remove objects from missing models, just warn. bzr revid: p_christ@hol.gr-20090126202751-721lgjp2lhvlh19e --- bin/addons/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 93a729f05e9..c1ff2e2abbe 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -700,7 +700,11 @@ def load_modules(db, force_demo=False, status=None, update_module=False): cr.execute('select model,res_id from ir_model_data where noupdate=%s and module=%s order by id desc', (False, mod_name,)) for rmod, rid in cr.fetchall(): uid = 1 - pool.get(rmod).unlink(cr, uid, [rid]) + rmod_module= pool.get(rmod) + if rmod_module: + rmod_module.unlink(cr, uid, [rid]) + else: + logger.notifyChannel('init', netsvc.LOG_ERROR, 'Could not locate %s to remove res=%d' % (rmod,rid)) cr.execute('delete from ir_model_data where noupdate=%s and module=%s', (False, mod_name,)) cr.commit() #