#
import threading
+import pooler
from osv import fields,osv
class procurement_compute(osv.osv_memory):
@param context: A standard dictionary
"""
proc_obj = self.pool.get('procurement.order')
- for proc in self.browse(cr, uid, ids, context=context):
- proc_obj._procure_orderpoint_confirm(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname, context=context)
-
+ #As this function is in a new thread, I need to open a new cursor, because the old one may be closed
+ new_cr = pooler.get_db(cr.dbname).cursor()
+ for proc in self.browse(new_cr, uid, ids, context=context):
+ proc_obj._procure_orderpoint_confirm(new_cr, uid, automatic=proc.automatic, use_new_cursor=new_cr.dbname, context=context)
+ #close the new cursor
+ new_cr.close()
return {}
def procure_calculation(self, cr, uid, ids, context=None):