From d9ff7c4efca6713f3d6d090b412632b3c78540cc Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 2 Jun 2014 19:47:03 +0200 Subject: [PATCH] [FIX] procurement: restore fixes for background procurement from rev.9b6f5dc, accidentally reverted by v8 WMS branch Probably forgotten during a sync with master, as the fixes belong to a different file now. This is the second part of the fix in previous commit. --- addons/stock/procurement.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py index 0a574579808..f53776d4b9a 100644 --- a/addons/stock/procurement.py +++ b/addons/stock/procurement.py @@ -271,7 +271,8 @@ class procurement_order(osv.osv): @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs - @param use_new_cursor: False or the dbname + @param use_new_cursor: if set, use a dedicated cursor and auto-commit after processing each procurement. + This is appropriate for batch jobs only. @param context: A standard dictionary for contextual values @return: Dictionary of values ''' @@ -280,7 +281,7 @@ class procurement_order(osv.osv): context = {} try: if use_new_cursor: - cr = openerp.registry(use_new_cursor).cursor() + cr = openerp.registry(cr.dbname).cursor() move_obj = self.pool.get('stock.move') @@ -333,15 +334,14 @@ class procurement_order(osv.osv): def _procure_orderpoint_confirm(self, cr, uid, use_new_cursor=False, company_id=False, context=None): ''' Create procurement based on Orderpoint - use_new_cursor: False or the dbname - @return: Dictionary of values - """ + :param bool use_new_cursor: if set, use a dedicated cursor and auto-commit after processing each procurement. + This is appropriate for batch jobs only. ''' if context is None: context = {} if use_new_cursor: - cr = openerp.registry(use_new_cursor).db.cursor() + cr = openerp.registry(cr.dbname).db.cursor() orderpoint_obj = self.pool.get('stock.warehouse.orderpoint') procurement_obj = self.pool.get('procurement.order')