Commit f0cb3704 authored by Vincent Pelletier's avatar Vincent Pelletier

Performance improvements:

- DO NOT use getObject to then just get an UID. It is ready to use in SQL result. This saves a roundtrip to ZODB (which can be in a remote ZEO server).
- DO NOT use getXXXUid() to then feed the uid to catalog to get the real object. Uid _has_ been fetched from the actual object in the accessor anyway. So just grab actual objects, and fetch uids from them when needed. This saves a roundtrip (...per iteration !) to catalog.
- Use "IN" instead of "OR" with equality in SQL query (minor improvement compared to the 2 above)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22567 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8efb1d7f
No related merge requests found
......@@ -68,14 +68,12 @@
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
current_tracking_list = [x.getObject() for x in context.portal_simulation.getCurrentTrackingList(\n
aggregate_uid_list = [x.uid for x in context.portal_simulation.getCurrentTrackingList(\n
at_date=at_date, node=node_url,\n
where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")]\n
aggregate_uid_list = [x.uid for x in current_tracking_list]\n
where_expression="item_catalog.portal_type IN (\'Check\', \'Checkbook\')")]\n
for line in context.getMovementList():\n
for aggregate_uid in line.getAggregateUidList():\n
if aggregate_uid not in aggregate_uid_list:\n
aggregate_value = context.portal_catalog(uid=aggregate_uid)[0].getObject()\n
for aggregate_value in line.getAggregateValueList():\n
if aggregate_value.getUid() not in aggregate_uid_list:\n
reference = aggregate_value.getReference()\n
if reference is None:\n
reference = \'%s - %s\' % (aggregate_value.getReferenceRangeMin() or \'\', aggregate_value.getReferenceRangeMax() or \'\')\n
......@@ -142,11 +140,8 @@ for line in context.getMovementList():\n
<string>_getattr_</string>
<string>context</string>
<string>x</string>
<string>current_tracking_list</string>
<string>aggregate_uid_list</string>
<string>line</string>
<string>aggregate_uid</string>
<string>_getitem_</string>
<string>aggregate_value</string>
<string>reference</string>
<string>None</string>
......
402
\ No newline at end of file
403
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment