<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
        <tuple/>
      </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>"""Returns all parameters from preferences or selection.\n
\n
This script gives priority to selection, and if not found in selection, it\n
tries to get the parameters from preference tool.\n
All parameters are stored/retrieved in a REQUEST cache, unless ignore_cache\n
argument is True.\n
\n
caveats:\n
  * wants_from_date parameter is not taken into account in the cache.\n
"""\n
\n
# do we have a cache already?\n
if not ignore_cache:\n
  params_cache = context.REQUEST.other.get(\n
          \'ERP5Accounting_getParams\', None)\n
  if params_cache is not None:\n
    # return a copy\n
    return dict(params_cache)\n
\n
params = {}\n
selection_params = {}\n
if selection_name is not None:\n
  # check if first parameter is used for selection instance\n
  if not isinstance(selection_name, str):\n
    context.log(\'Using selection parameter is deprecated. Please use selection_name instead.\')\n
    selection_name = selection_name.getName()\n
  selection_params = context.portal_selections.getSelectionParamsFor(selection_name)\n
elif selection is not None:\n
  context.log(\'Using selection parameter is deprecated. Please use selection_name instead.\')\n
  selection_params = selection.getParams()\n
preference = context.getPortalObject().portal_preferences\n
\n
from_date = None\n
if wants_from_date:\n
  from_date = selection_params.get(\'from_date\',\n
                preference.getPreferredAccountingTransactionFromDate())\n
  if from_date :\n
    params[\'from_date\'] = from_date\n
\n
at_date = selection_params.get(\'at_date\',\n
              preference.getPreferredAccountingTransactionAtDate())\n
if at_date:\n
  params[\'at_date\'] = at_date.latestTime()\n
\n
section_category = selection_params.get(\'section_category\',\n
                 preference.getPreferredAccountingTransactionSectionCategory())\n
if section_category:\n
  params[\'section_uid\'] = context.Base_getSectionUidListForSectionCategory(section_category)\n
  currency = context.Base_getCurrencyForSection(section_category)\n
  # getQuantityPrecisionFromResource is defined on Base, but the portal is not \n
  # an instance of Base, so we call it on account_module.\n
  params[\'precision\'] = context.account_module\\\n
                            .getQuantityPrecisionFromResource(currency)\n
\n
  # calculate the period_start_date for this section\n
  # note that reports that precalculate a section_uid but no section_category\n
  # will have to calculate period_start_date themselves.\n
  if from_date or at_date:\n
    params[\'period_start_date\'] = \\\n
          context.Base_getAccountingPeriodStartDateForSectionCategory(\n
              section_category=section_category, date=from_date or at_date)\n
\n
# if we have a section uid, it haves priority\n
section_uid = selection_params.get(\'section_uid\', None)\n
if section_uid:\n
  params.pop(\'section_category\', None)\n
  params[\'section_uid\'] = section_uid\n
\n
# also if we have an explicit precision key, it has priority\n
precision = selection_params.get(\'precision\', None)\n
if precision is not None:\n
  params[\'precision\'] = precision\n
\n
# Some reports, such as general ledger, uses different forms with different report\n
# parameters, we don\'t want to accidentally fill the cache with mirror_section_uid \n
# or payment_uid.\n
if not selection_params.get(\'no_mirror_section_uid_cache\', 0):\n
  mirror_section_uid = selection_params.get(\'mirror_section_uid\', None)\n
  if mirror_section_uid:\n
    params[\'mirror_section_uid\'] = mirror_section_uid\n
\n
  payment_uid = selection_params.get(\'payment_uid\', None)\n
  if payment_uid:\n
    params[\'payment_uid\'] = payment_uid\n
\n
# Detailed Beginning Balance, from Account Statement \n
detailed_from_date_summary = selection_params.get(\'detailed_from_date_summary\', None)\n
if detailed_from_date_summary is not None:\n
  params[\'detailed_from_date_summary\'] = detailed_from_date_summary\n
\n
simulation_state = selection_params.get(\'simulation_state\',\n
             preference.getPreferredAccountingTransactionSimulationStateList())\n
if simulation_state:\n
  params[\'simulation_state\'] = simulation_state\n
\n
portal_type = selection_params.get(\'movement_portal_type\', None)\n
if portal_type:\n
  params[\'portal_type\'] = portal_type\n
else:\n
  parent_portal_type = selection_params.get(\'parent_portal_type\', None)\n
  if parent_portal_type:\n
    params[\'parent_portal_type\'] = parent_portal_type\n
\n
if not ignore_cache:\n
  context.REQUEST.other[\'ERP5Accounting_getParams\'] = params\n
return dict(params)\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_name=None, wants_from_date=0, ignore_cache=0, selection=None</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>4</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>selection_name</string>
                            <string>wants_from_date</string>
                            <string>ignore_cache</string>
                            <string>selection</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>None</string>
                            <string>params_cache</string>
                            <string>dict</string>
                            <string>params</string>
                            <string>selection_params</string>
                            <string>isinstance</string>
                            <string>str</string>
                            <string>preference</string>
                            <string>from_date</string>
                            <string>_write_</string>
                            <string>at_date</string>
                            <string>section_category</string>
                            <string>currency</string>
                            <string>section_uid</string>
                            <string>precision</string>
                            <string>mirror_section_uid</string>
                            <string>payment_uid</string>
                            <string>detailed_from_date_summary</string>
                            <string>simulation_state</string>
                            <string>portal_type</string>
                            <string>parent_portal_type</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <none/>
                <int>0</int>
                <int>0</int>
                <none/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ERP5Accounting_getParams</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
