Skip to Content
Menu
This question has been flagged

I want export individual de.po files for all installed modules in my odoo database. The exported po files are incorrect if tools.trans_export() is called more than once in a for loop. (for instance the translation of "HTTP routing" of web_editor module) I suppose this is an orm cache problem.

My code

        from subprocess import call

        prod_info_obj = self.pool.get('ir.module.module')
        prod_info_ids = prod_info_obj.search(cr, uid, [('state','=','installed')])
        if prod_info_ids:
            the_modules = prod_info_obj.browse(cr, uid, prod_info_ids, context)

        the_path = '/home/test/po_export/'
        x = 0

        for a_module in the_modules:
            if x>-1:
           # if "web_editor" == a_module.name: 
                with contextlib.closing(cStringIO.StringIO()) as buf:
                    # parameter modul als [] liste nötig, jedes modul einzeln sonst alles in einer po datei 
                    tools.trans_export('de_DE', [a_module.name], buf, 'po', cr)
                    #out = base64.encodestring(buf.getvalue())
                    out = buf.getvalue()
                call("mkdir -p " + the_path + a_module.name, shell=True)
                f = open(the_path + a_module.name + '/de.po', 'w')
                f.write(out)
                f.close
                x=x+1
Avatar
Discard

what do you mean with incorrect? what problem did you saw?

Related Posts Replies Views Activity
1
Jun 22
9853
3
Sep 22
14988
0
Dec 20
897
0
Jun 21
3885
0
Dec 20
1469