<?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 encoding="cdata"><![CDATA[

from DateTime import DateTime\n
from Products.ERP5Type.Document import newTempBase\n
\n
portal = context.getPortalObject()\n
selection_params = portal.portal_selections.getSelectionParamsFor(selection_name)\n
get_inventory_kw = {\n
    \'section_category\': selection_params.get(\'section_category\')\n
  , \'simulation_state\': selection_params.get(\'simulation_state\')\n
  , \'node_category\'   : selection_params.get(\'gap_root\')\n
  , \'omit_simulation\' : True\n
  , \'where_expression\': " section.portal_type = \'Organisation\' "\n
}\n
\n
at_date   = selection_params.get(\'at_date\', None)\n
from_date = selection_params.get(\'from_date\', None)\n
\n
getInventory = portal.portal_simulation.getInventoryAssetPrice\n
\n
# FIXME: Here we do not want to sum all movement < 0, but sum the balances\n
#        of all nodes whose which have a < 0 balance...\n
opening_debit_balance  = 0.0\n
opening_credit_balance = 0.0\n
closing_debit_balance  = 0.0\n
closing_credit_balance = 0.0\n
if from_date not in (None, \'\'):\n
  opening_debit_balance = getInventory( at_date     = from_date\n
                                      , omit_output = True\n
                                      , **get_inventory_kw\n
                                      )\n
  opening_credit_balance = - getInventory( at_date    = from_date\n
                                         , omit_input = True\n
                                         , **get_inventory_kw\n
                                         )\n
closing_debit_balance = getInventory( at_date     = at_date\n
                                    , omit_output = True\n
                                    , **get_inventory_kw\n
                                    )\n
closing_credit_balance = - getInventory( at_date    = at_date\n
                                       , omit_input = True\n
                                       , **get_inventory_kw\n
                                       )\n
\n
list_item = newTempBase(portal, \'xxx\')\n
list_item.setUid(\'new_000\')\n
list_item.edit(** {\n
    \'total_opening_debit_balance\' : opening_debit_balance\n
  , \'total_closing_debit_balance\' : closing_debit_balance\n
  , \'total_opening_credit_balance\': opening_credit_balance\n
  , \'total_closing_credit_balance\': closing_credit_balance\n
  })\n
\n
return [list_item]\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>selection, selection_name, **kw</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>2</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>selection</string>
                            <string>selection_name</string>
                            <string>kw</string>
                            <string>DateTime</string>
                            <string>Products.ERP5Type.Document</string>
                            <string>newTempBase</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>selection_params</string>
                            <string>True</string>
                            <string>get_inventory_kw</string>
                            <string>None</string>
                            <string>at_date</string>
                            <string>from_date</string>
                            <string>getInventory</string>
                            <string>opening_debit_balance</string>
                            <string>opening_credit_balance</string>
                            <string>closing_debit_balance</string>
                            <string>closing_credit_balance</string>
                            <string>_apply_</string>
                            <string>list_item</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>AccountModule_getTrialBalanceSummary</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
