Commit 5bfb8d13 authored by Yoshinori Okuji's avatar Yoshinori Okuji

2010-06-21 yo

* Rewrite InventoryModule_reindexMovementList, as this script still assumed the older implementation of reindexObject which indexed a delta for each inventory movement, but now we index all movements from each inventory document at a time, thus this script started to do needless indexing.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36479 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5194d664
...@@ -53,36 +53,36 @@ ...@@ -53,36 +53,36 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string># Inventory requires reindexing when older movements become available, because\n
# inventory generates deltas against the past stock, using a catalog. It is only\n
# look in the catalog to all inventory movement sort on date\n # necessary to reindex Inventory documents instead of Inventory movements, because\n
count = 1\n # Inventory reindexes its movements in a special way to the stock table by itself.\n
#\n
# FIXME: I think it would be better to replace this script with a good interactor\n
# which reindexes future inventory documents.\n
\n \n
previous_tag = None\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
# We have to reindex all inventory in the order of the date\n # We have to reindex all inventory documents in the order of the dates.\n
for o in [ x.getObject() for x in portal.portal_catalog(\n # Uids are used to make the ordering consistent, even when multiple documents have\n
portal_type = portal.getPortalInventoryMovementTypeList()\n # the same date.\n
, limit = None\n for inventory in portal.portal_catalog(portal_type=portal.getPortalInventoryTypeList(),\n
, sort_on = [(\'movement.start_date\',\'ascending\')]\n limit=None,\n
, sql_catalog_id = sql_catalog_id\n sort_on=[(\'delivery.start_date\', \'ascending\'), (\'uid\', \'ascending\')],\n
)\n sql_catalog_id=sql_catalog_id):\n
]:\n inventory = inventory.getObject()\n
activate_kw = {\n tag = \'inventory_%i\' % inventory.getUid()\n
\'tag\': \'inventory_%i\' % (count+1),\n activate_kw = dict(tag=tag, passive_commit=passive_commit)\n
\'after_tag\': \'inventory_%i\' % count,\n if previous_tag is not None:\n
\'passive_commit\': passive_commit,\n activate_kw[\'after_tag\'] = previous_tag\n
}\n previous_tag = tag\n
o.reindexObject(activate_kw=activate_kw, sql_catalog_id=sql_catalog_id)\n inventory.reindexObject(activate_kw=activate_kw, sql_catalog_id=sql_catalog_id)\n
count += 1\n
\n \n
if final_activity_tag is not None and count > 1:\n if final_activity_tag is not None and previous_tag is not None:\n
# Dummy activity used to determine if the previously started activities are over.\n # Dummy activity used to determine if the previously started activities are over.\n
context.activate(tag=final_activity_tag\n context.activate(tag=final_activity_tag, after_tag=previous_tag).getId()\n
,after_tag=\'inventory_%i\' % (count - 1, )).getId()\n </string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -122,18 +122,17 @@ if final_activity_tag is not None and count > 1:\n ...@@ -122,18 +122,17 @@ if final_activity_tag is not None and count > 1:\n
<string>passive_commit</string> <string>passive_commit</string>
<string>final_activity_tag</string> <string>final_activity_tag</string>
<string>kw</string> <string>kw</string>
<string>count</string> <string>None</string>
<string>previous_tag</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>append</string> <string>inventory</string>
<string>$append0</string> <string>tag</string>
<string>None</string> <string>dict</string>
<string>x</string>
<string>o</string>
<string>activate_kw</string> <string>activate_kw</string>
<string>_inplacevar_</string> <string>_write_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
2010-06-21 yo
* Rewrite InventoryModule_reindexMovementList, as this script still assumed the older implementation of reindexObject which indexed a delta for each inventory movement, but now we index all movements from each inventory document at a time, thus this script started to do needless indexing.
2010-06-14 Kazuhiko 2010-06-14 Kazuhiko
* Index portal_type in translation table to avoid unexpected verbose results of translated state search. * Index portal_type in translation table to avoid unexpected verbose results of translated state search.
......
1617 1618
\ No newline at end of file \ 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