[FIX] Translation should not fail if lang=False is passed anyhow

bzr revid: ach@tinyerp.com-20100726130052-fwvjx0z4qf2xxaf6
This commit is contained in:
Anup (OpenERP)
2010-07-26 18:30:52 +05:30
parent 097883185e
commit 0e776c38ea
+4 -2
View File
@@ -133,16 +133,18 @@ class ir_translation(osv.osv):
'and type=%s ' \
'and name=%s ' \
'and src=%s',
(lang, tt, tools.ustr(name), source))
(lang or '', tt, tools.ustr(name), source))
else:
cr.execute('select value ' \
'from ir_translation ' \
'where lang=%s ' \
'and type=%s ' \
'and name=%s',
(lang, tt, tools.ustr(name)))
(lang or '', tt, tools.ustr(name)))
res = cr.fetchone()
trad = res and res[0] or ''
if source and not trad:
return source
return trad
def create(self, cursor, user, vals, context=None):