Technical mailing list archives

How to get a new cursor on new api on Thread

Maxim Litnitskiy
- 09/22/2014 05:12:45
Hi dear Experts!
We have old api code:

        with Environment.manage():
            cr = self.pool.cursor()
            dialer = self.pool['asterisk.dialer'].browse(cr, uid, ids, context=context)[0]

It works.
Now how to do the same with new api?

        with Environment.manage():
            dialer = self.env['asterisk.dialer'].browse([dialer_id])

Gives the following error: OperationalError: Unable to use a closed cursor.
Please advise.