Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6038 Lượt xem

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
Ảnh đại diện
Huỷ bỏ

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
Query caching Đã xử lý
1
thg 6 25
11198
3
thg 9 22
17885
0
thg 12 20
1632
0
thg 6 21
5046
0
thg 12 20
2250