Odoo Help


How solve Odoo ORM cache issue than call tools.trans_export() in a for loop?

on 1/25/16, 7:49 AM 890 views

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')

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

Axel Mendoza
on 1/25/16, 11:42 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/25/16, 7:49 AM
Seen: 890 times
Last updated: 1/25/16, 9:46 AM