Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-906727-mma into 
lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #906727 in OpenERP Addons: "Procurement: compute stock minimum rules only 
generates Traceback "
  https://bugs.launchpad.net/openobject-addons/+bug/906727

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-906727-mma/+merge/86355

Hello,

        procurement: I Have a add a new cr for the new thread

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-906727-mma/+merge/86355
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-906727-mma.
=== modified file 'procurement/wizard/orderpoint_procurement.py'
--- procurement/wizard/orderpoint_procurement.py	2011-01-14 00:11:01 +0000
+++ procurement/wizard/orderpoint_procurement.py	2011-12-20 09:48:01 +0000
@@ -25,6 +25,7 @@
 #
 
 import threading
+import pooler
 from osv import fields,osv
 
 class procurement_compute(osv.osv_memory):
@@ -48,9 +49,12 @@
         @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):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to