[MERGE] backward porting of revision 9222 in 7.0
authorMartin Trigaux <mat@openerp.com>
Tue, 11 Jun 2013 15:12:55 +0000 (17:12 +0200)
committerMartin Trigaux <mat@openerp.com>
Tue, 11 Jun 2013 15:12:55 +0000 (17:12 +0200)
[IMP] report_webkit: avoid using same src value for two different values with fallback

bzr revid: mat@openerp.com-20130611151255-gem9jtyauef6jign

addons/report_webkit/webkit_report.py

index 007d7fb..a166275 100644 (file)
@@ -181,8 +181,13 @@ class WebKitParser(report_sxw):
     def translate_call(self, src):
         """Translate String."""
         ir_translation = self.pool.get('ir.translation')
+        name = self.tmpl and 'addons/' + self.tmpl or None
         res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
-                                         None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
+                                         name, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
+        if res == src:
+            # no translation defined, fallback on None (backward compatibility)
+            res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
+                                             None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
         if not res :
             return src
         return res