<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
        <tuple/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <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
# necessary to reindex Inventory documents instead of Inventory movements, because\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
previous_tag = None\n
portal = context.getPortalObject()\n
\n
# We have to reindex all inventory documents in the order of the dates.\n
# Uids are used to make the ordering consistent, even when multiple documents have\n
# the same date.\n
for inventory in portal.portal_catalog(portal_type=portal.getPortalInventoryTypeList(),\n
                                       limit=None,\n
                                       sort_on=[(\'delivery.start_date\', \'ascending\'), (\'uid\', \'ascending\')],\n
                                       sql_catalog_id=sql_catalog_id):\n
  inventory = inventory.getObject()\n
  tag = \'inventory_%i\' % inventory.getUid()\n
  activate_kw = dict(tag=tag, passive_commit=passive_commit)\n
  if previous_tag is not None:\n
    activate_kw[\'after_tag\'] = previous_tag\n
  previous_tag = tag\n
  inventory.reindexObject(activate_kw=activate_kw, sql_catalog_id=sql_catalog_id)\n
\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
  context.activate(tag=final_activity_tag, after_tag=previous_tag).getId()\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>sql_catalog_id=None, passive_commit=1, final_activity_tag=None, **kw</string> </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>3</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>sql_catalog_id</string>
                            <string>passive_commit</string>
                            <string>final_activity_tag</string>
                            <string>kw</string>
                            <string>None</string>
                            <string>previous_tag</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>_getiter_</string>
                            <string>inventory</string>
                            <string>tag</string>
                            <string>dict</string>
                            <string>activate_kw</string>
                            <string>_write_</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <none/>
                <int>1</int>
                <none/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>InventoryModule_reindexMovementList</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
