<?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># As Open Sale Order codebase is unstable Assignor proxied role script is introduced\n
# to cleanup finialised Open Sale Order Line\n
\n
if REQUEST is not None:\n
  # protect against direct HTTP access, XML-RPC will still work\n
  raise ValueError(\'Not available\')\n
from Products.ZSQLCatalog.SQLCatalog import NegatedQuery, Query\n
\n
portal = context.getPortalObject()\n
all_delivered = True\n
for sale_packing_list_line in portal.portal_catalog(\n
  portal_type="Sale Packing List Line", \n
  default_aggregate_uid=context.getUid(),\n
  simulation_state=NegatedQuery(Query(simulation_state="delivered")),\n
  ):\n
  if sale_packing_list_line.getSimulationState() != \'delivered\':\n
    all_delivered = False\n
if all_delivered:\n
  open_order_line = context.getAggregateRelatedValue(portal_type="Open Sale Order Line")\n
  if open_order_line is not None:\n
    # XXX: Mahybe system shall *NOT* work without Open Sale Orders\n
    open_order_line.getParentValue().manage_delObjects(open_order_line.getId())\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>REQUEST=None</string> </value>
        </item>
        <item>
            <key> <string>_proxy_roles</string> </key>
            <value>
              <tuple>
                <string>Assignor</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>HostingSubscription_removeRelatedOpenSaleOrderLine</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
