From 0e776c38ea594a7fee45aac2aea58a6d38e911d6 Mon Sep 17 00:00:00 2001 From: "Anup (OpenERP)" Date: Mon, 26 Jul 2010 18:30:52 +0530 Subject: [PATCH] [FIX] Translation should not fail if lang=False is passed anyhow bzr revid: ach@tinyerp.com-20100726130052-fwvjx0z4qf2xxaf6 --- bin/addons/base/ir/ir_translation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/ir/ir_translation.py b/bin/addons/base/ir/ir_translation.py index 571e98b818d..aeb3f5bdfa3 100644 --- a/bin/addons/base/ir/ir_translation.py +++ b/bin/addons/base/ir/ir_translation.py @@ -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):