From 1e9b41e2a42823dd4ba6f8a948861652f2872712 Mon Sep 17 00:00:00 2001
From: Olivier Dony <odo@openerp.com>
Date: Mon, 2 Jun 2014 18:57:26 +0200
Subject: [PATCH] [FIX] procurement: restore fix for background procurement
 from 9b6f5dc, accidentally reverted by WMS branch for v8

Probably forgotten during a sync with master, as the
fix belongs to a different file now.
---
 addons/procurement/procurement.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py
index beedac5fe96a..2ebc800ec04b 100644
--- a/addons/procurement/procurement.py
+++ b/addons/procurement/procurement.py
@@ -276,7 +276,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
         '''
@@ -284,7 +285,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()
 
             # Run confirmed procurements
             while True:
-- 
GitLab