Commit c26a4650 authored by Jérome Perrin's avatar Jérome Perrin

Don't pass period_start_date to getInventory to prevent a catalog warning

parent 59e75401
......@@ -137,11 +137,11 @@ if params.get(\'node_uid\'):\n
or node.isMemberOf(\'account_type/income\')\n
\n
\n
period_start_date = params.pop(\'period_start_date\', None)\n
if is_pl_account and not from_date:\n
from_date = params.get(\'period_start_date\')\n
from_date = period_start_date\n
\n
if from_date or is_pl_account:\n
period_start_date = None\n
# Create a new parameter list to get the previous balance\n
get_inventory_kw = params.copy()\n
\n
......@@ -150,11 +150,10 @@ if from_date or is_pl_account:\n
# ignore any at_date that could lay in params\n
get_inventory_kw.pop(\'at_date\', None)\n
\n
if params.has_key(\'period_start_date\'):\n
if period_start_date:\n
if is_pl_account:\n
# if we have on an expense / income account, only take into account\n
# movements from the current period.\n
period_start_date = params[\'period_start_date\']\n
if initial_balance_from_date:\n
initial_balance_from_date = max(period_start_date,\n
initial_balance_from_date)\n
......@@ -162,7 +161,6 @@ if from_date or is_pl_account:\n
initial_balance_from_date = period_start_date\n
else:\n
# for all other accounts, we calculate initial balance\n
period_start_date = params[\'period_start_date\']\n
if not initial_balance_from_date:\n
# I don\'t think this should happen\n
log(\'from_date not passed, defaulting to period_start_date\')\n
......
......@@ -52,6 +52,7 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ZSQLCatalog.SQLCatalog import Query\n
portal = context.getPortalObject()\n
\n
params = portal.ERP5Accounting_getParams(selection_name=selection_name)\n
getInventoryAssetPrice = portal.portal_simulation.getInventoryAssetPrice\n
getSelectionDomainDictFor = context.portal_selections.getSelectionDomainDictFor\n
......@@ -116,7 +117,9 @@ if kw.get(\'where_expression\'):\n
if not \'parent_portal_type\' in params:\n
params.setdefault(\'portal_type\', portal.getPortalAccountingMovementTypeList())\n
\n
if params.get(\'period_start_date\', 0) and params.get(\'node_uid\'):\n
period_start_date = params.pop(\'period_start_date\', None)\n
\n
if period_start_date and params.get(\'node_uid\'):\n
# find the node for this node_uid\n
if context.getUid() == params[\'node_uid\']: # I bet it\'s context\n
node = context\n
......@@ -129,12 +132,11 @@ if params.get(\'period_start_date\', 0) and params.get(\'node_uid\'):\n
# beginning is passed explicitly.\n
# if we are in the regular user interface, we only limit\n
if \'from_date\' in kw:\n
params[\'from_date\'] = min(kw[\'from_date\'], params[\'period_start_date\'])\n
params[\'from_date\'] = min(kw[\'from_date\'], period_start_date)\n
else:\n
# for other account, we calculate the initial balance as the "absolute"\n
# balance at the beginning of the period, plus debit or credit from this\n
# beginning of period to the from_date\n
period_start_date = params[\'period_start_date\']\n
at_date = params.pop(\'at_date\', None)\n
period_openning_balance = getInventoryAssetPrice(\n
selection_domain=getSelectionDomainDictFor(selection_name),\n
......
1502
\ No newline at end of file
1503
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment