<?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>"""\n
  This scripts add the balance of every gap account in the list \'accounts\'\n
  it use portal_simulation.getInventory. \n
  The following REQUEST keys are mandatory : \n
      at_date\n
\n
  those are optional : \n
      gap_base\n
      simulation_state\n
      resource\n
      section_category\n
\n
  those are ignored from the request and should explicitely passed as keywords args to this script : \n
      from_date\n
  \n
  parameters keywords to this script overrides REQUEST keys\n
\n
"""\n
\n
request = context.REQUEST\n
kw = {}\n
kw[\'omit_simulation\']   = 1\n
kw[\'omit_input\']=1\n
kw["simulation_state"]  = request.get("simulation_state", [\'stopped\', \'delivered\'])\n
#kw["section_uid"]     = context.restrictedTraverse(request.get("organisation")).getUid()\n
kw["at_date"]           = request[\'at_date\']\n
kw["from_date"]         = request[\'from_date\']\n
kw.update(params_kw)\n
\n
\n
sum = 0\n
for account in accounts :\n
  kw[\'node_category\']= context.shortAccountNumberToFullGapCategory(account)\n
  #context.log(\'KW for getInventory\',kw)\n
  try : \n
    #val = (context.portal_simulation.getInventory(**kw) or 0)\n
    val = (context.portal_simulation.getInventoryAssetPrice(**kw) or 0)\n
    sum += val\n
  except KeyError : # unknown gap account (i.e. not a category)\n
    pass\n
  except AttributeError: # no account of this gap nr has been set up\n
    return 0\n
#  except :\n
#    raise \'error on\', (account, shortAccountNumberToFullGapCategory(account))\n
return float ("%.2f"%(sum))\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>accounts, **params_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>1</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>accounts</string>
                            <string>params_kw</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>request</string>
                            <string>kw</string>
                            <string>_write_</string>
                            <string>_getitem_</string>
                            <string>sum</string>
                            <string>_getiter_</string>
                            <string>account</string>
                            <string>_apply_</string>
                            <string>val</string>
                            <string>KeyError</string>
                            <string>AttributeError</string>
                            <string>float</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>FiscalReportCell_doGetInventory</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
