[FIX] upgrade doesn't try to delete modules

lp bug: https://launchpad.net/bugs/357045 fixed

bzr revid: christophe@tinyerp.com-20090612110033-hw8acue29oh0f2rx
This commit is contained in:
Christophe Simonis 2009-06-12 13:00:33 +02:00
parent e12f2d28a3
commit 60cf794c7d
3 changed files with 7 additions and 5 deletions

View File

@ -581,8 +581,9 @@ class ir_model_data(osv.osv):
self.unlink(cr, uid, [id])
cr.execute('DELETE FROM ir_values WHERE value=%s', ('%s,%s' % (model, res_id),))
cr.commit()
except:
except Exception, e:
cr.rollback()
logger.notifyChannel('init', netsvc.LOG_ERROR, e)
logger.notifyChannel('init', netsvc.LOG_ERROR, 'Could not delete id: %d of model %s\nThere should be some relation that points to this resource\nYou should manually fix this and restart --update=module' % (res_id, model))
return True
ir_model_data()

View File

@ -493,10 +493,11 @@ class module(osv.osv):
id = super(module, self).create(cr, uid, data, context)
if data.get('name'):
self.pool.get('ir.model.data').create(cr, uid, {
'name': 'module_name_translation',
'name': 'module_meta_information',
'model': 'ir.module.module',
'res_id': id,
'module': data['name']
'module': data['name'],
'noupdate': True,
})
return id
module()

View File

@ -100,8 +100,8 @@ def init_db(cr):
info.get('website', ''), i, info.get('name', False),
info.get('description', ''), p_id, state, info.get('certificate')))
cr.execute('insert into ir_model_data \
(name,model,module, res_id) values (%s,%s,%s,%s)', (
'module_meta_information', 'ir.module.module', i, id))
(name,model,module, res_id, noupdate) values (%s,%s,%s,%s,%s)', (
'module_meta_information', 'ir.module.module', i, id, True))
dependencies = info.get('depends', [])
for d in dependencies:
cr.execute('insert into ir_module_module_dependency \