[FIX] base: export translation: propose the right filename
authorChristophe Simonis <chs@tinyerp.com>
Tue, 16 Feb 2010 11:06:36 +0000 (12:06 +0100)
committerChristophe Simonis <chs@tinyerp.com>
Tue, 16 Feb 2010 11:06:36 +0000 (12:06 +0100)
bzr revid: chs@tinyerp.com-20100216110636-b1r6veimh4qgw03q

bin/addons/base/module/wizard/wizard_export_lang.py

index 1e538b9..b59351b 100644 (file)
 #
 ##############################################################################
 
-import wizard
 import tools
 import base64
 import cStringIO
-import csv
 import pooler
 from osv import fields,osv
 from tools.translate import _
+from tools.misc import get_iso_codes
 
 class wizard_export_lang(osv.osv_memory):
 
@@ -35,7 +34,6 @@ class wizard_export_lang(osv.osv_memory):
         ids=lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
         langs=lang_obj.browse(cr, uid, ids)
         return [(lang.code, lang.name) for lang in langs]
-    
 
     def act_cancel(self, cr, uid, ids, context=None):
         #self.unlink(cr, uid, ids, context)
@@ -62,7 +60,9 @@ class wizard_export_lang(osv.osv_memory):
         filename = _('new')
         if not this.lang and len(mods) == 1:
             filename = mods[0]
-        this.name = "%s.%s" % (this.lang or filename, this.format)
+        if this.lang:
+            filename = get_iso_codes(this.lang)
+        this.name = "%s.%s" % (filename, this.format)
         out=base64.encodestring(buf.getvalue())
         buf.close()
         return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice, 'name':this.name}, context=context)