<?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>select_kw = kwargs.copy()\n
select_kw.pop(\'portal_type\', None)\n
select_kw.pop(\'delivery_relative_url_list\', None)\n
from Products.ERP5Type.Document import newTempSimulationMovement\n
portal = context.getPortalObject()\n
\n
business_process_uid_list = [\n
  portal.business_process_module.slapos_consumption_business_process.getUid(),\n
  portal.business_process_module.slapos_subscription_business_process.getUid()]\n
specialise_reference_list = [q.getReference() for q in portal.portal_catalog(specialise_uid=business_process_uid_list,\n
  portal_type=\'Sale Trade Condition\')]\n
\n
select_kw.update(\n
  limit=50, # just take a bit\n
  portal_type=\'Sale Packing List Line\',\n
  simulation_state=\'delivered\',\n
  parent_specialise_reference=specialise_reference_list,\n
  parent_specialise_portal_type=\'Sale Trade Condition\',\n
  grouping_reference=None,\n
  sort_on=((\'modification_date\', \'ASC\'),) # the highest chance to find movement which can be delivered\n
)\n
movement_list = portal.portal_catalog(**select_kw)\n
\n
specialise = portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()\n
temp_movement_list = []\n
id = 1\n
for movement in movement_list:\n
  if movement.getGroupingReference() is not None:\n
    continue\n
  temp_movement = newTempSimulationMovement(\n
    portal, movement.getRelativeUrl(),\n
    quantity=movement.getQuantity(),\n
    resource=movement.getResource(),\n
    source=movement.getDestination(),\n
    destination=movement.getDestination(),\n
    source_section=movement.getSourceSection(),\n
    destination_section=movement.getDestination(),\n
    destination_decision=movement.getDestination(),\n
    specialise=specialise,\n
    price_currency=movement.getPriceCurrency()\n
  )\n
  if movement.getResource() == \'service_module/slapos_instance_subscription\':\n
     temp_movement.edit(price=0.83612040133800003)\n
  else:\n
     temp_movement.edit(price=0.0)\n
  temp_movement_list.append(temp_movement)\n
  id += 1\n
\n
return temp_movement_list\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>*args, **kwargs</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>OrderBuilder_generateSlapOSAggregatedMovementList</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
