From e05d255c010e8bb660d81c16909ed44b5961cd32 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 15 Feb 2010 18:20:14 +0530 Subject: [PATCH] [FIX] if not lang in get_source method on transaltion then return blank bzr revid: mra@tinyerp.com-20100215125014-duvoo2ppwup959xn --- bin/addons/base/ir/ir_translation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/addons/base/ir/ir_translation.py b/bin/addons/base/ir/ir_translation.py index e33365fcfca..73536ac339f 100644 --- a/bin/addons/base/ir/ir_translation.py +++ b/bin/addons/base/ir/ir_translation.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -35,7 +35,7 @@ TRANSLATION_TYPE = [ ('help', 'Help'), ('code', 'Code'), ('constraint', 'Constraint'), - ('sql_constraint', 'SQL Constraint') + ('sql_constraint', 'SQL Constraint') ] class ir_translation(osv.osv): @@ -123,6 +123,8 @@ class ir_translation(osv.osv): @tools.cache(skiparg=3) def _get_source(self, cr, uid, name, tt, lang, source=None): + if not lang: + return '' if source: #if isinstance(source, unicode): # source = source.encode('utf8') @@ -143,7 +145,7 @@ class ir_translation(osv.osv): res = cr.fetchone() trad = res and res[0] or '' return trad - + def create(self, cursor, user, vals, context=None): if not context: context = {} @@ -151,7 +153,7 @@ class ir_translation(osv.osv): for trans_obj in self.read(cursor, user, [ids], ['name','type','res_id'], context=context): self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US')) self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']]) - return ids + return ids def write(self, cursor, user, ids, vals, context=None): if not context: @@ -169,7 +171,7 @@ class ir_translation(osv.osv): self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US')) self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']]) result = super(ir_translation, self).unlink(cursor, user, ids, context=context) - return result + return result ir_translation()