<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
    </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 encoding="cdata"><![CDATA[

from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
installation = state_change[\'object\']\n
# Get required arguments\n
\n
software_release_document = installation.Base_getSoftwareReleaseDocument(installation.getUrlString())\n
if software_release_document is None:\n
  raise NotImplemnetedError(\'Software Release %r not ready yet\' % instance.getUrlString())\n
\n
\n
portal = installation.getPortalObject()\n
computer = installation.getAggregateValue(portal_type=\'Computer\')\n
\n
\n
tag = \'SoftwareInstallation_%s_software_release_%s_change\' % (installation.getUid(), software_release_document.getUid())\n
if portal.portal_activities.countMessageWithTag(tag) > 0:\n
  raise NotImplementedError(\'In progress\')\n
activate_kw = {\'tag\': tag}\n
\n
# XXX Hardcoded values\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
packing_list_portal_type = "Purchase Packing List"\n
module = portal.getDefaultModule(portal_type=packing_list_portal_type)\n
packing_list = module.newContent(\n
  portal_type=packing_list_portal_type,\n
  start_date=DateTime(),\n
  destination_value=person,\n
  destination_section_value=person,\n
  destination_decision_value=person,\n
  source_administration_value=person,\n
  # XXX Hardcoded values\n
  source="organisation_module/vifib_internet",\n
  source_section="organisation_module/vifib_internet",\n
  price_currency="currency_module/EUR",\n
  activate_kw=activate_kw\n
)\n
packing_list.newContent(\n
  portal_type="Purchase Packing List Line",\n
  resource=service,\n
  aggregate_value_list=[software_release_document, computer, installation],\n
  quantity=1,\n
  activate_kw=activate_kw\n
)\n
\n
packing_list.confirm(activate_kw=activate_kw)\n
packing_list.startBuilding()\n
\n
return packing_list\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>state_change, service</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Installation_createPurchasePackingList</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
