[FIX] avoid a crash when installing a language for a non present but installed module

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

bzr revid: christophe@tinyerp.com-20090115162815-xjnwwrgn211p5sa3
This commit is contained in:
Christophe Simonis 2009-01-15 17:28:15 +01:00
parent 8edf442785
commit 863785242d
1 changed files with 5 additions and 2 deletions

View File

@ -462,9 +462,12 @@ class module(osv.osv):
for mod in self.browse(cr, uid, ids):
if mod.state != 'installed':
continue
modpath = addons.get_module_path(mod.name)
if not modpath:
# unable to find the module. we skip
continue
for lang in filter_lang:
f = os.path.join(addons.get_module_path(mod.name), 'i18n', lang + '.po')
f = os.path.join(modpath, 'i18n', lang + '.po')
if os.path.exists(f):
logger.notifyChannel("init", netsvc.LOG_INFO, 'module %s: loading translation file for language %s' % (mod.name, lang))
tools.trans_load(cr.dbname, f, lang, verbose=False)