<?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>instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
\n
# Get current sale order\n
delivery = instance.getCausalityValue(portal_type=["Sale Order"])\n
\n
sale_order_line = delivery.contentValues(portal_type="Sale Order Line")[0]\n
\n
packing_list_module = portal.getDefaultModule(portal_type=\'Sale Packing List\')\n
packing_list = packing_list_module.newContent(\n
  portal_type=\'Sale Packing List\',\n
  specialise=delivery.getSpecialise() or delivery.getCausalityValue().getSpecialise(),\n
  destination=delivery.getDestination(),\n
  destination_section=delivery.getDestinationSection(),\n
  destination_decision=delivery.getDestinationDecision(),\n
  source=delivery.getSource(),\n
  source_section=delivery.getSourceSection(),\n
  price_currency=delivery.getPriceCurrency(),\n
  start_date=DateTime())\n
\n
packing_list_line = packing_list.newContent(\n
  portal_type=\'Sale Packing List Line\',\n
  resource=service.getRelativeUrl(),\n
  quantity_unit="unit/piece",\n
  quantity=1,\n
  aggregate_list=sale_order_line.getAggregateList(),\n
  # XXX Hardcode price on service\n
  price=service.getSaleSupplyLineBasePrice(),\n
)\n
\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>Instance_createSalePackingList</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
