From 0744ca5b71249977229a5d923718280a843afcce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 16 Jun 2017 10:34:49 +0000
Subject: [PATCH] bank_reconciliation: prefer portal_catalog() over
 portal_catalog.getObject

getObject is not public API. Bonus is we can do one query for all uids
---
 .../BankReconciliation_reconcileTransactionList.py        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_reconcileTransactionList.py b/bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_reconcileTransactionList.py
index af88e59250..2d04fd5b81 100644
--- a/bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_reconcileTransactionList.py
+++ b/bt5/erp5_bank_reconciliation/SkinTemplateItem/portal_skins/erp5_bank_reconciliation/BankReconciliation_reconcileTransactionList.py
@@ -6,8 +6,8 @@ portal.portal_selections.updateSelectionCheckedUidList(list_selection_name, list
 selection_uid_list = portal.portal_selections.getSelectionCheckedUidsFor(list_selection_name)
 
 if mode == 'reconcile':
-  for uid in selection_uid_list:
-    line = portal.portal_catalog.getObject(uid)
+  for line in portal.portal_catalog(uid=selection_uid_list or -1):
+    line = line.getObject()
     if line.getAggregate(portal_type='Bank Reconciliation'):
       return context.Base_redirect(dialog_id,
                   abort_transaction=True,
@@ -27,8 +27,8 @@ if mode == 'reconcile':
       'reconciled_uid_list': selection_uid_list})
 
 assert mode == 'unreconcile'
-for uid in selection_uid_list:
-  line = portal.portal_catalog.getObject(uid)
+for line in portal.portal_catalog(uid=selection_uid_list or -1):
+  line = line.getObject()
   line.AccountingTransactionLine_setBankReconciliation(None,
     message=translateString("Reconciling Bank Line"))
 
-- 
2.30.9