<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <tuple>
          <string>Products.PythonScripts.PythonScript</string>
          <string>PythonScript</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Python_magic</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>__ac_local_roles__</string> </key>
            <value>
              <none/>
            </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>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
from Products.ZSQLCatalog.SQLCatalog import ComplexQuery\n
\n
period = state_change[\'object\']\n
portal = period.getPortalObject()\n
N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
\n
\n
valid_simulation_state_list = [\'cancelled\', \'delivered\', \'deleted\', \'rejected\']\n
all_state_list = [x[1] for x in\n
  portal.Base_getTranslatedWorkflowStateItemList(wf_id=\'accounting_workflow\')]\n
invalid_simulation_state_list = [state for state in all_state_list\n
                                 if state not in valid_simulation_state_list]\n
\n
section_uid = period.getParentUid()\n
search_params = {\n
  \'delivery.start_date\': dict(query=period.getStartDate(),\n
                              range=\'min\'),\n
  \'delivery.stop_date\': dict(query=period.getStopDate(),\n
                             range=\'ngt\'),\n
  \'simulation_state\': invalid_simulation_state_list,\n
  \'portal_type\': portal.getPortalAccountingTransactionTypeList(),\n
  \'query\': ComplexQuery(Query(source_section_uid=section_uid),\n
                        Query(destination_section_uid=section_uid),\n
                        operator=\'OR\')\n
}\n
\n
transaction_list = portal.portal_catalog.searchResults(**search_params)\n
if transaction_list:\n
  raise ValidationFailed, N_(\n
    "All Accounting Transactions for this organisation during the period have"\n
    " to be closed first")\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>state_change</string> </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>1</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>state_change</string>
                            <string>Products.DCWorkflow.DCWorkflow</string>
                            <string>ValidationFailed</string>
                            <string>Products.ERP5Type.Message</string>
                            <string>Message</string>
                            <string>Products.ZSQLCatalog.SQLCatalog</string>
                            <string>Query</string>
                            <string>ComplexQuery</string>
                            <string>_getitem_</string>
                            <string>period</string>
                            <string>_getattr_</string>
                            <string>portal</string>
                            <string>N_</string>
                            <string>valid_simulation_state_list</string>
                            <string>append</string>
                            <string>$append0</string>
                            <string>_getiter_</string>
                            <string>x</string>
                            <string>all_state_list</string>
                            <string>state</string>
                            <string>invalid_simulation_state_list</string>
                            <string>section_uid</string>
                            <string>dict</string>
                            <string>search_params</string>
                            <string>_apply_</string>
                            <string>transaction_list</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>checkTransactionsState</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
