<?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[

if params is None:\n
  params = {}\n
\n
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import addToDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
def getAccountingDate(accounting_date):\n
  accounting_day = 25\n
  if accounting_date.day() <= accounting_day:\n
    accounting_date = addToDate(accounting_date, dict(month=-1))\n
  diff = accounting_day - accounting_date.day()\n
  accounting_date = addToDate(accounting_date, dict(day=diff))\n
  return accounting_date\n
\n
accounting_date = params.get(\'accounting_date\', DateTime().earliestTime())\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
  portal_type=\'Sale Packing List\',\n
  simulation_state=\'confirmed\',\n
  causality_state=\'solved\',\n
  specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
  method_id=\'Delivery_deliverConfirmedAggregatedSalePackingList\',\n
  activate_kw={\'tag\': tag},\n
  **{\'delivery.start_date\': Query(range="max",\n
    **{\'delivery.start_date\': getAccountingDate(accounting_date)})}\n
)\n
context.activate(after_tag=tag).getId()\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>tag, fixit, params</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Alarm_deliverConfirmedAggregatedSalePackingList</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
