Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
5833 Переглядів

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
Аватар
Відмінити

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

Related Posts Відповіді Переглядів Дія
Query caching Вирішено
1
черв. 25
11007
3
вер. 22
17447
0
груд. 20
1483
0
черв. 21
4832
0
груд. 20
2122