Technical mailing list archives
Re: How to get a new cursor on new api on Threadby
The following seem to work reliably:
new_cr = sql_db.db_connect(self.env.cr.dbname).cursor()
uid, context = self.env.uid, self.env.context
self.env = api.Environment(new_cr, uid, context)
FInally assures that cursor is closed on thready error or exit.
Thanks for advises.
P.S. May be this link can tell more if you are interested - https://github.com/litnimax/odoo-asterisk-dialer/blob/master/models/dialer.py#L218