[MERGE] lp: 906727 new cursor when processing procurements

bzr revid: qdp-launchpad@openerp.com-20111229170051-7zdxkifk1diqhxj9
This commit is contained in:
Quentin (OpenERP)
2011-12-29 18:00:51 +01:00
@@ -25,6 +25,7 @@
#
import threading
import pooler
from osv import fields,osv
class procurement_compute(osv.osv_memory):
@@ -48,9 +49,12 @@ 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):