python 2.7 - Openerp asynchronous process -
this similar python asynchronous processing in existing loop; have time consuming python method needs run (user initiated) asynchronously user can keep working on else while method running on backend.
i using threading cursor gets closed , have re-create it, , when writing db getting error 'generatorcontextmanager' object has no attribute 'dbname'.
my simplified code:
import threading def call_validar(self, cr, uid, ids, context=none): t = threading.thread(target=self.test_threading, args=(cr, uid, ids, context,)) t.start() return true def test_threading(self, cr, uid, ids, context=none): id in ids: my_cr = self.pool.cursor() # cursor needs re-created try: self.write(my_cr, uid, id, {'validation_logs': 'just anything'}) except exception, e: # 'generatorcontextmanager' object has no attribute 'dbname' _logger.info('error e [%s] context [%s]' % (e,context)) return true
what missing?
mayte
Comments
Post a Comment